Changeset 116601 in webkit


Ignore:
Timestamp:
May 9, 2012 8:30:48 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[BlackBerry] Cookie parsing issue. If the cookie value provided was (") then the browser creates a session cookie instead.
https://bugs.webkit.org/show_bug.cgi?id=85775

Patch by Jason Liu <jason.liu@torchmobile.com.cn> on 2012-05-09
Reviewed by Rob Buis.

Source/WebCore:

Make CookieParser::parseOneCookie handle (cookiename="cookievalue;expires=xxxx) correctly.
This cookie's value is "cookievalue not "cookievalue;expires=xxxx.

Test: http/tests/cookies/single-quoted-value.html

  • platform/blackberry/CookieParser.cpp:

(WebCore::CookieParser::parseOneCookie):

LayoutTests:

  • http/tests/cookies/script-tests/single-quoted-value.js: Added.
  • http/tests/cookies/single-quoted-value-expected.txt: Added.
  • http/tests/cookies/single-quoted-value.html: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r116598 r116601  
     12012-05-09  Jason Liu  <jason.liu@torchmobile.com.cn>
     2
     3        [BlackBerry] Cookie parsing issue. If the cookie value provided was (") then the browser creates a session cookie instead.
     4        https://bugs.webkit.org/show_bug.cgi?id=85775
     5
     6        Reviewed by Rob Buis.
     7
     8        * http/tests/cookies/script-tests/single-quoted-value.js: Added.
     9        * http/tests/cookies/single-quoted-value-expected.txt: Added.
     10        * http/tests/cookies/single-quoted-value.html: Added.
     11
    1122012-05-09  Hayato Ito  <hayato@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r116596 r116601  
     12012-05-09  Jason Liu  <jason.liu@torchmobile.com.cn>
     2
     3        [BlackBerry] Cookie parsing issue. If the cookie value provided was (") then the browser creates a session cookie instead.
     4        https://bugs.webkit.org/show_bug.cgi?id=85775
     5
     6        Reviewed by Rob Buis.
     7
     8        Make CookieParser::parseOneCookie handle (cookiename="cookievalue;expires=xxxx) correctly.
     9        This cookie's value is "cookievalue not "cookievalue;expires=xxxx.
     10
     11        Test: http/tests/cookies/single-quoted-value.html
     12
     13        * platform/blackberry/CookieParser.cpp:
     14        (WebCore::CookieParser::parseOneCookie):
     15
    1162012-05-09  Raymond Liu  <raymond.liu@intel.com>
    217
  • trunk/Source/WebCore/platform/blackberry/CookieParser.cpp

    r114608 r116601  
    110110    unsigned pairEnd = start; // Pair end contains always the position of the ';'
    111111
    112     // find the *first* ';' and the '=' (if they exist)
    113     bool quoteFound = false;
     112    // Find the first ';' which is not double-quoted and the '=' (if they exist).
    114113    bool foundEqual = false;
    115     while (pairEnd < end && (cookie[pairEnd] != ';' || quoteFound)) {
    116         if (tokenEnd == start && cookie[pairEnd] == '=') {
    117             tokenEnd = pairEnd;
    118             foundEqual = true;
    119         }
    120         if (cookie[pairEnd] == '"')
    121             quoteFound = !quoteFound;
     114    while (pairEnd < end && cookie[pairEnd] != ';') {
     115        if (cookie[pairEnd] == '=') {
     116            if (tokenEnd == start) {
     117                tokenEnd = pairEnd;
     118                foundEqual = true;
     119            }
     120        } else if (cookie[pairEnd] == '"') {
     121            size_t secondQuotePosition = cookie.find('"', pairEnd + 1);
     122            if (secondQuotePosition != notFound && secondQuotePosition <= end) {
     123                pairEnd = secondQuotePosition + 1;
     124                continue;
     125            }
     126        }
    122127        pairEnd++;
    123128    }
Note: See TracChangeset for help on using the changeset viewer.