Changeset 208086 in webkit
- Timestamp:
- Oct 28, 2016, 5:17:01 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r208083 r208086 1 2016-10-28 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should not try to interpret host of URLs with unrecognized schemes as IPv4 address 4 https://bugs.webkit.org/show_bug.cgi?id=164154 5 6 Reviewed by Andy Estes. 7 8 This is needed to match behavior of all browsers. 9 This is being discussed in the spec at https://github.com/whatwg/url/issues/148 10 11 Covered by new API tests. 12 13 * platform/URLParser.cpp: 14 (WebCore::URLParser::parseHostAndPort): 15 Only try to parse and canonicalize the host as an IPv4 address if the scheme is special (http, wss, etc.) 16 1 17 2016-10-28 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/Source/WebCore/platform/URLParser.cpp
r207805 r208086 2573 2573 return false; 2574 2574 } 2575 if (auto address = parseIPv4Host(CodePointIterator<CharacterType>(hostIterator, iterator))) { 2576 serializeIPv4(address.value()); 2577 m_url.m_hostEnd = currentPosition(iterator); 2578 if (iterator.atEnd()) { 2579 m_url.m_portEnd = currentPosition(iterator); 2580 return true; 2581 } 2582 return parsePort(iterator); 2575 if (m_urlIsSpecial) { 2576 if (auto address = parseIPv4Host(CodePointIterator<CharacterType>(hostIterator, iterator))) { 2577 serializeIPv4(address.value()); 2578 m_url.m_hostEnd = currentPosition(iterator); 2579 if (iterator.atEnd()) { 2580 m_url.m_portEnd = currentPosition(iterator); 2581 return true; 2582 } 2583 return parsePort(iterator); 2584 } 2583 2585 } 2584 2586 for (; hostIterator != iterator; ++hostIterator) { 2585 if (LIKELY(!isTabOrNewline(*hostIterator))) { 2586 if (m_urlIsSpecial) { 2587 if (UNLIKELY(isASCIIUpper(*hostIterator))) 2588 syntaxViolation(hostIterator); 2589 appendToASCIIBuffer(toASCIILower(*hostIterator)); 2590 } else 2591 appendToASCIIBuffer(*hostIterator); 2587 if (UNLIKELY(isTabOrNewline(*hostIterator))) { 2588 syntaxViolation(hostIterator); 2589 continue; 2590 } 2591 if (m_urlIsSpecial) { 2592 if (UNLIKELY(isASCIIUpper(*hostIterator))) 2593 syntaxViolation(hostIterator); 2594 appendToASCIIBuffer(toASCIILower(*hostIterator)); 2592 2595 } else 2593 syntaxViolation(hostIterator);2596 appendToASCIIBuffer(*hostIterator); 2594 2597 } 2595 2598 m_url.m_hostEnd = currentPosition(iterator); -
trunk/Tools/ChangeLog
r208066 r208086 1 2016-10-28 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should not try to interpret host of URLs with unrecognized schemes as IPv4 address 4 https://bugs.webkit.org/show_bug.cgi?id=164154 5 6 Reviewed by Andy Estes. 7 8 * TestWebKitAPI/Tests/WebCore/URLParser.cpp: 9 (TestWebKitAPI::TEST_F): 10 1 11 2016-10-28 Sam Weinig <sam@webkit.org> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp
r207805 r208086 950 950 {"", "", "", "", 0, "", "", "", "http://[a:b:c:d:e:f::127.0.0.256]"}, 951 951 {"http", "", "", "[a:b:c:d:e:f::127.0.0.256]", 0, "/", "", "", "http://[a:b:c:d:e:f::127.0.0.256]/"}); 952 checkURLDifferences("http://123456", {"http", "", "", "0.1.226.64", 0, "/", "", "", "http://0.1.226.64/"}, {"http", "", "", "123456", 0, "/", "", "", "http://123456/"}); 953 checkURL("asdf://123456", {"asdf", "", "", "123456", 0, "", "", "", "asdf://123456"}); 954 checkURLDifferences("http://[0:0:0:0:a:b:c:d]", 955 {"http", "", "", "[::a:b:c:d]", 0, "/", "", "", "http://[::a:b:c:d]/"}, 956 {"http", "", "", "[0:0:0:0:a:b:c:d]", 0, "/", "", "", "http://[0:0:0:0:a:b:c:d]/"}); 957 checkURLDifferences("asdf://[0:0:0:0:a:b:c:d]", 958 {"asdf", "", "", "[::a:b:c:d]", 0, "", "", "", "asdf://[::a:b:c:d]"}, 959 {"asdf", "", "", "[0:0:0:0:a:b:c:d]", 0, "", "", "", "asdf://[0:0:0:0:a:b:c:d]"}); 952 960 } 953 961 … … 1106 1114 shouldFail("http://[a:b:c:d:e:f:127.0.-0.1]"); 1107 1115 shouldFail("asdf://space InHost"); 1116 shouldFail("asdf://[0:0:0:0:a:b:c:d"); 1108 1117 } 1109 1118
Note:
See TracChangeset
for help on using the changeset viewer.