Changeset 174712 in webkit


Ignore:
Timestamp:
Oct 14, 2014 4:58:34 PM (10 years ago)
Author:
mitz@apple.com
Message:

URLs that start with http:/// and https:/// lose two slashes when parsed, causing assertion failure and inconsistent behavior
https://bugs.webkit.org/show_bug.cgi?id=137718

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Added cases to fast/loader/url-parse-1.html.

  • platform/URL.cpp:

(WebCore::URL::parse): In hierarchical schemes other than file:, ignore any additional
slashes after the :, as prescribed by the authority-ignore-slashes state in the current
URL spec.

LayoutTests:

  • fast/loader/url-parse-1-expected.txt: Updated results.
  • fast/loader/url-parse-1.html: Added a few test cases.
  • fast/url/file-http-base-expected.txt: Updated results.
  • fast/url/host-expected.txt: Ditto.
  • fast/url/invalid-urls-utf8-expected.txt: Ditto.
  • fast/url/relative-expected.txt: Ditto.
  • fast/url/standard-url-expected.txt: Ditto.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r174707 r174712  
     12014-10-14  Dan Bernstein  <mitz@apple.com>
     2
     3        URLs that start with http:/// and https:/// lose two slashes when parsed, causing assertion failure and inconsistent behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=137718
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * fast/loader/url-parse-1-expected.txt: Updated results.
     9        * fast/loader/url-parse-1.html: Added a few test cases.
     10        * fast/url/file-http-base-expected.txt: Updated results.
     11        * fast/url/host-expected.txt: Ditto.
     12        * fast/url/invalid-urls-utf8-expected.txt: Ditto.
     13        * fast/url/relative-expected.txt: Ditto.
     14        * fast/url/standard-url-expected.txt: Ditto.
     15
    1162014-10-14  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/LayoutTests/fast/loader/url-parse-1-expected.txt

    r105307 r174712  
    2525http:// http:/          /
    2626http:///        http:/          /
    27 http:////       http://         //
     27http:////       http:/          /
     28http:webkit.org http://webkit.org/      webkit.org      /
     29http:/webkit.org        http://webkit.org/      webkit.org      /
     30http://webkit.org       http://webkit.org/      webkit.org      /
     31http:///webkit.org      http://webkit.org/      webkit.org      /
     32http:////webkit.org     http://webkit.org/      webkit.org      /
     33http://///webkit.org    http://webkit.org/      webkit.org      /
     34http://////webkit.org   http://webkit.org/      webkit.org      /
     35http:////////////////webkit.org http://webkit.org/      webkit.org      /
    2836http://localhost        http://localhost/       localhost       /
    2937http://localhost/       http://localhost/       localhost       /
  • trunk/LayoutTests/fast/loader/url-parse-1.html

    r122687 r174712  
    6868            "http:///",
    6969            "http:////",
     70            "http:webkit.org",
     71            "http:/webkit.org",
     72            "http://webkit.org",
     73            "http:///webkit.org",
     74            "http:////webkit.org",
     75            "http://///webkit.org",
     76            "http://////webkit.org",
     77            "http:////////////////webkit.org",
    7078            "http://localhost",
    7179            "http://localhost/",
  • trunk/LayoutTests/fast/url/file-http-base-expected.txt

    r105294 r174712  
    2828FAIL canonicalize('//') should be file:///. Was http:/.
    2929FAIL canonicalize('///') should be file:///. Was http:/.
    30 FAIL canonicalize('///test') should be file:///test. Was http:/test.
     30FAIL canonicalize('///test') should be file:///test. Was http://test/.
    3131PASS canonicalize('file://test') is 'file://test/'
    3232FAIL canonicalize('file://localhost') should be file://localhost/. Was file:///.
  • trunk/LayoutTests/fast/url/host-expected.txt

    r149925 r174712  
    3434PASS canonicalize('http://www.lookout.net::80::443/') is 'http://www.lookout.net::80::443/'
    3535PASS canonicalize('http://\.//') is 'http://.//'
    36 FAIL canonicalize('http:////:@//') should be http:////. Was http://:@//.
     36FAIL canonicalize('http:////:@//') should be http:////. Was http:////:@//.
    3737PASS canonicalize('http://\google.com/foo/') is 'http://google.com/foo/'
    38 FAIL canonicalize('http://\\google.com/foo/') should be http://google.com/foo/. Was http:/google.com/foo/.
    39 PASS canonicalize('http:////asdf@//') is 'http://asdf@//'
     38PASS canonicalize('http://\\google.com/foo/') is 'http://google.com/foo/'
     39FAIL canonicalize('http:////asdf@//') should be http://asdf@//. Was http:////asdf@//.
    4040PASS canonicalize('http:////:81/') is 'http://:81/'
    4141PASS canonicalize('http://:///') is 'http://:///'
     
    4343PASS canonicalize('http://xxxx:/') is 'http://xxxx/'
    4444PASS canonicalize('http://.:./') is 'http://.:./'
    45 FAIL canonicalize('http://////@google.com//') should be http://google.com//. Was http:////@google.com//.
     45PASS canonicalize('http://////@google.com//') is 'http://google.com//'
    4646PASS canonicalize('http://@google.com/') is 'http://google.com/'
    4747PASS successfullyParsed is true
  • trunk/LayoutTests/fast/url/invalid-urls-utf8-expected.txt

    r129445 r174712  
    66FAIL src should be http:///. Was http:/.
    77FAIL src should be https:///. Was https:/.
    8 PASS src is expected
    9 PASS src is expected
    10 PASS src is expected
    11 PASS src is expected
     8FAIL src should be ftp:///. Was ftp://.
     9FAIL src should be gopher:///. Was gopher://.
     10FAIL src should be ws:///. Was ws://.
     11FAIL src should be wss:///. Was wss://.
    1212PASS src is expected
    1313PASS src is expected
  • trunk/LayoutTests/fast/url/relative-expected.txt

    r104414 r174712  
    5353PASS canonicalize('//another') is 'http://another/'
    5454PASS canonicalize('//another/path?query#ref') is 'http://another/path?query#ref'
    55 FAIL canonicalize('///another/path') should be http://another/path. Was http:/another/path.
     55PASS canonicalize('///another/path') is 'http://another/path'
    5656PASS canonicalize('//Another\\path') is 'http://another/path'
    5757FAIL canonicalize('//') should be http:. Was http:/.
  • trunk/LayoutTests/fast/url/standard-url-expected.txt

    r104414 r174712  
    88PASS canonicalize('http://[www.google.com]/') is 'http://[www.google.com]/'
    99PASS canonicalize('http://www.google.com') is 'http://www.google.com/'
    10 FAIL canonicalize('http:////////user:@google.com:99?foo') should be http://user@google.com:99/?foo. Was http://////user:@google.com:99?foo.
     10PASS canonicalize('http:////////user:@google.com:99?foo') is 'http://user@google.com:99/?foo'
    1111FAIL canonicalize('http://192.0x00A80001') should be http://192.168.0.1/. Was http://192.0x00a80001/.
    1212FAIL canonicalize('http://www/foo%2Ehtml') should be http://www/foo.html. Was http://www/foo%2Ehtml.
  • trunk/Source/WebCore/ChangeLog

    r174710 r174712  
     12014-10-14  Dan Bernstein  <mitz@apple.com>
     2
     3        URLs that start with http:/// and https:/// lose two slashes when parsed, causing assertion failure and inconsistent behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=137718
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Added cases to fast/loader/url-parse-1.html.
     9
     10        * platform/URL.cpp:
     11        (WebCore::URL::parse): In hierarchical schemes other than file:, ignore any additional
     12        slashes after the ://, as prescribed by the authority-ignore-slashes state in the current
     13        URL spec.
     14
    1152014-10-14  Brent Fulgham  <bfulgham@apple.com>
    216
  • trunk/Source/WebCore/platform/URL.cpp

    r167480 r174712  
    248248static inline bool isPathSegmentEndChar(UChar c) { return c <= 0xff && (characterClassTable[c] & PathSegmentEndChar); }
    249249static inline bool isBadChar(unsigned char c) { return characterClassTable[c] & BadChar; }
    250    
     250
    251251static inline bool isSchemeCharacterMatchIgnoringCase(char character, char schemeCharacter)
    252252{
     
    11411141        // FIXME: Authority characters may be scanned twice, and it would be nice to be faster.
    11421142
    1143         if (hierarchical)
     1143        if (hierarchical) {
    11441144            userStart++;
    1145         if (hasSecondSlash)
    1146             userStart++;
     1145            if (hasSecondSlash) {
     1146                userStart++;
     1147                if (isNonFileHierarchicalScheme(url, schemeEnd)) {
     1148                    while (url[userStart] == '/')
     1149                        userStart++;
     1150                }
     1151            }
     1152        }
     1153
    11471154        userEnd = userStart;
    11481155
Note: See TracChangeset for help on using the changeset viewer.