Changeset 78383 in webkit
- Timestamp:
- Feb 11, 2011 3:47:06 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r78374 r78383 1 2011-02-11 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 KURL should remove default port numbers when cannonicalizing urls (to match every other browser) 6 https://bugs.webkit.org/show_bug.cgi?id=54090 7 8 Added a new test to show that we are intentionally removing 9 a colon after a host name. http://foo.com:/ -> http://foo.com/ 10 11 * fast/url/port-expected.txt: 12 * fast/url/relative-unix-expected.txt: 13 * fast/url/segments-expected.txt: 14 * fast/url/segments-from-data-url-expected.txt: 15 * fast/url/standard-url-expected.txt: 16 1 17 2011-02-11 Mihai Parparita <mihaip@chromium.org> 2 18 -
trunk/LayoutTests/fast/url/port-expected.txt
r57588 r78383 6 6 FAIL canonicalize('http://www.example.com:as df/') should be http://www.example.com:as%20df/. Was http://www.example.com:as df/. 7 7 PASS canonicalize('http://www.example.com:-2/') is 'http://www.example.com:-2/' 8 FAIL canonicalize('http://www.example.com:80/') should be http://www.example.com/. Was http://www.example.com:80/. 8 PASS canonicalize('http://www.example.com:80/') is 'http://www.example.com/' 9 9 PASS canonicalize('http://www.example.com:8080/') is 'http://www.example.com:8080/' 10 PASS canonicalize('http://www.example.com:/') is 'http://www.example.com/' 10 11 PASS canonicalize('foobar://www.example.com:80/') is 'foobar://www.example.com:80/' 11 12 PASS successfullyParsed is true -
trunk/LayoutTests/fast/url/relative-unix-expected.txt
r78044 r78383 6 6 PASS canonicalize('\\\\Another\\path') is 'http://another/path' 7 7 PASS canonicalize('/c:\\foo') is 'http://host/c:/foo' 8 FAIL canonicalize('//c:\\foo') should be http://c/foo. Was http://c:/foo. 8 PASS canonicalize('//c:\\foo') is 'http://c/foo' 9 9 PASS successfullyParsed is true 10 10 -
trunk/LayoutTests/fast/url/relative-win-expected.txt
r57785 r78383 9 9 FAIL canonicalize('/../bar.html') should be file:///C:/bar.html. Was file:///bar.html. 10 10 FAIL canonicalize('\\\\another\\path') should be . Was http://another/path. 11 FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file://c :/foo.11 FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file://c/foo. 12 12 FAIL canonicalize('//localhost/c:/foo') should be file:///C:/foo. Was file:///c:/foo. 13 13 FAIL canonicalize('c:') should be . Was c:. -
trunk/LayoutTests/fast/url/script-tests/port.js
r57588 r78383 8 8 ["80", ""], 9 9 ["8080", ":8080"], 10 // Empty ports (just a colon) should also be removed 11 ["", ""], 10 12 ]; 11 13 -
trunk/LayoutTests/fast/url/segments-expected.txt
r78040 r78383 68 68 PASS segments('http://2001::1]:80') is '[":","","0","","",""]' 69 69 PASS segments('http://[2001::1]') is '["http:","[2001::1]","0","/","",""]' 70 FAIL segments('http://[2001::1]:80') should be ["http:","[2001::1]","0","/","",""]. Was ["http:","[2001::1]","80","/","",""]. 70 PASS segments('http://[2001::1]:80') is '["http:","[2001::1]","0","/","",""]' 71 71 PASS segments('http://[[::]]') is '[":","","0","","",""]' 72 72 PASS successfullyParsed is true -
trunk/LayoutTests/fast/url/segments-from-data-url-expected.txt
r78040 r78383 68 68 PASS segments('http://2001::1]:80') is '[":","","0","","",""]' 69 69 PASS segments('http://[2001::1]') is '["http:","[2001::1]","0","/","",""]' 70 FAIL segments('http://[2001::1]:80') should be ["http:","[2001::1]","0","/","",""]. Was ["http:","[2001::1]","80","/","",""]. 70 PASS segments('http://[2001::1]:80') is '["http:","[2001::1]","0","/","",""]' 71 71 PASS segments('http://[[::]]') is '[":","","0","","",""]' 72 72 PASS successfullyParsed is true -
trunk/LayoutTests/fast/url/standard-url-expected.txt
r78044 r78383 13 13 PASS canonicalize('http:\\\\www.google.com\\foo') is 'http://www.google.com/foo' 14 14 FAIL canonicalize('http://www.google.com/asdf#\ud800') should be http://www.google.com/asdf#�. Was http://www.google.com/asdf#%26%2355296%3B. 15 FAIL canonicalize('http://foo:80/') should be http://foo/. Was http://foo:80/. 15 PASS canonicalize('http://foo:80/') is 'http://foo/' 16 16 PASS canonicalize('http://foo:81/') is 'http://foo:81/' 17 17 PASS canonicalize('httpa://foo:80/') is 'httpa://foo:80/' 18 18 PASS canonicalize('http://foo:-80/') is 'http://foo:-80/' 19 FAIL canonicalize('https://foo:443/') should be https://foo/. Was https://foo:443/. 19 PASS canonicalize('https://foo:443/') is 'https://foo/' 20 20 PASS canonicalize('https://foo:80/') is 'https://foo:80/' 21 FAIL canonicalize('ftp://foo:21/') should be ftp://foo/. Was ftp://foo:21/. 21 PASS canonicalize('ftp://foo:21/') is 'ftp://foo/' 22 22 PASS canonicalize('ftp://foo:80/') is 'ftp://foo:80/' 23 FAIL canonicalize('gopher://foo:70/') should be gopher://foo/. Was gopher://foo:70/. 23 PASS canonicalize('gopher://foo:70/') is 'gopher://foo/' 24 24 PASS canonicalize('gopher://foo:443/') is 'gopher://foo:443/' 25 FAIL canonicalize('ws://foo:80/') should be ws://foo/. Was ws://foo:80/. 25 PASS canonicalize('ws://foo:80/') is 'ws://foo/' 26 26 PASS canonicalize('ws://foo:81/') is 'ws://foo:81/' 27 27 PASS canonicalize('ws://foo:443/') is 'ws://foo:443/' … … 29 29 PASS canonicalize('wss://foo:80/') is 'wss://foo:80/' 30 30 PASS canonicalize('wss://foo:81/') is 'wss://foo:81/' 31 FAIL canonicalize('wss://foo:443/') should be wss://foo/. Was wss://foo:443/. 31 PASS canonicalize('wss://foo:443/') is 'wss://foo/' 32 32 PASS canonicalize('wss://foo:815/') is 'wss://foo:815/' 33 33 PASS successfullyParsed is true -
trunk/LayoutTests/platform/mac/http/tests/inspector/console-websocket-error-expected.txt
r74611 r78383 6 6 7 7 console-websocket-error.html:32testDNSLookup: Test started. 8 ws://nonexistent.domain.invalid :80/WebSocket network error: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.)8 ws://nonexistent.domain.invalid/WebSocket network error: The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 2.) 9 9 console-websocket-error.html:43testDNSLookup: onclose is called. 10 10 console-websocket-error.html:50testSSLCertificate: Test started. -
trunk/LayoutTests/platform/mac/security/block-test-expected.txt
r74453 r78383 138 138 http://255.255.255.255:0/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:0/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 139 139 http://255.255.255.255:0/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255:0/test.jpg"> 140 http://255.255.255.255 :80/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:80/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null)141 http://255.255.255.255 :80/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255:80/test.jpg">142 http://255.255.255.255 :/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255:/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null)143 http://255.255.255.255 :/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255:/test.jpg">140 http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 141 http://255.255.255.255/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255/test.jpg"> 142 http://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL http://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 143 http://255.255.255.255/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1004, failing URL "http://255.255.255.255/test.jpg"> 144 144 ftp://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL ftp://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 145 145 ftp://255.255.255.255/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1, failing URL "ftp://255.255.255.255/test.jpg"> 146 ftp://255.255.255.255 :21/test.jpg - willSendRequest <NSURLRequest URL ftp://255.255.255.255:21/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null)147 ftp://255.255.255.255 :21/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1, failing URL "ftp://255.255.255.255:21/test.jpg">146 ftp://255.255.255.255/test.jpg - willSendRequest <NSURLRequest URL ftp://255.255.255.255/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 147 ftp://255.255.255.255/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1, failing URL "ftp://255.255.255.255/test.jpg"> 148 148 ftp://255.255.255.255:22/test.jpg - willSendRequest <NSURLRequest URL ftp://255.255.255.255:22/test.jpg, main document URL block-test.html, http method GET> redirectResponse (null) 149 149 ftp://255.255.255.255:22/test.jpg - didFailLoadingWithError: <NSError domain NSURLErrorDomain, code -1, failing URL "ftp://255.255.255.255:22/test.jpg"> -
trunk/Source/WebCore/ChangeLog
r78377 r78383 1 2011-02-11 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 KURL should remove default port numbers when cannonicalizing urls (to match every other browser) 6 https://bugs.webkit.org/show_bug.cgi?id=54090 7 8 * platform/KURL.cpp: 9 (WebCore::isDefaultPortForScheme): 10 (WebCore::KURL::parse): 11 1 12 2011-02-11 Mike Reed <reed@google.com> 2 13 -
trunk/Source/WebCore/platform/KURL.cpp
r78044 r78383 1101 1101 } 1102 1102 1103 static inline bool equal(const char* a, size_t lenA, const char* b, size_t lenB) 1104 { 1105 if (lenA != lenB) 1106 return false; 1107 return !strncmp(a, b, lenA); 1108 } 1109 1110 // List of default schemes is taken from google-url: 1111 // http://code.google.com/p/google-url/source/browse/trunk/src/url_canon_stdurl.cc#120 1112 static inline bool isDefaultPortForScheme(const char* port, size_t portLength, const char* scheme, size_t schemeLength) 1113 { 1114 // This switch is theoretically a performance optimization. It came over when 1115 // the code was moved from google-url, but may be removed later. 1116 switch (schemeLength) { 1117 case 2: 1118 return equal("ws", 2, scheme, schemeLength) && equal("80", 2, port, portLength); 1119 case 3: 1120 if (equal("ftp", 3, scheme, schemeLength)) 1121 return equal("21", 2, port, portLength); 1122 if (equal("wss", 3, scheme, schemeLength)) 1123 return equal("443", 3, port, portLength); 1124 break; 1125 case 4: 1126 return equal("http", 4, scheme, schemeLength) && equal("80", 2, port, portLength); 1127 case 5: 1128 return equal("https", 5, scheme, schemeLength) && equal("443", 3, port, portLength); 1129 case 6: 1130 return equal("gopher", 6, scheme, schemeLength) && equal("70", 2, port, portLength); 1131 } 1132 return false; 1133 } 1134 1103 1135 void KURL::parse(const char* url, const String* originalString) 1104 1136 { … … 1336 1368 m_hostEnd = p - buffer.data(); 1337 1369 1338 // copy in the port1370 // Copy in the port if the URL has one (and it's not default). 1339 1371 if (hostEnd != portStart) { 1340 *p++ = ':'; 1341 strPtr = url + portStart; 1342 const char *portEndPtr = url + portEnd; 1343 while (strPtr < portEndPtr) 1344 *p++ = *strPtr++; 1372 const char* portStr = url + portStart; 1373 size_t portLength = portEnd - portStart; 1374 if (portLength && !isDefaultPortForScheme(portStr, portLength, buffer.data(), m_schemeEnd)) { 1375 *p++ = ':'; 1376 const char* portEndPtr = url + portEnd; 1377 while (portStr < portEndPtr) 1378 *p++ = *portStr++; 1379 } 1345 1380 } 1346 1381 m_portEnd = p - buffer.data();
Note: See TracChangeset
for help on using the changeset viewer.