Title: [206548] trunk
Revision
206548
Author
achristen...@apple.com
Date
2016-09-28 14:14:44 -0700 (Wed, 28 Sep 2016)

Log Message

URLParser should ignore extra slashes after scheme:// and handle a missing slash after the port
https://bugs.webkit.org/show_bug.cgi?id=162690

Reviewed by Geoffrey Garen.

Source/WebCore:

Covered by new API tests.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):

Tools:

* TestWebKitAPI/Tests/WebCore/URLParser.cpp:
(TestWebKitAPI::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206547 => 206548)


--- trunk/Source/WebCore/ChangeLog	2016-09-28 21:12:04 UTC (rev 206547)
+++ trunk/Source/WebCore/ChangeLog	2016-09-28 21:14:44 UTC (rev 206548)
@@ -1,5 +1,17 @@
 2016-09-28  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should ignore extra slashes after scheme:// and handle a missing slash after the port
+        https://bugs.webkit.org/show_bug.cgi?id=162690
+
+        Reviewed by Geoffrey Garen.
+
+        Covered by new API tests.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+
+2016-09-28  Alex Christensen  <achristen...@webkit.org>
+
         URLParser should correctly canonicalize uppercase IPv6 addresses
         https://bugs.webkit.org/show_bug.cgi?id=162680
 

Modified: trunk/Source/WebCore/platform/URLParser.cpp (206547 => 206548)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-09-28 21:12:04 UTC (rev 206547)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-09-28 21:14:44 UTC (rev 206548)
@@ -1290,12 +1290,13 @@
         case State::SpecialAuthorityIgnoreSlashes:
             LOG_STATE("SpecialAuthorityIgnoreSlashes");
             if (*c == '/' || *c == '\\') {
-                appendToASCIIBuffer('/');
+                syntaxViolation(c);
                 ++c;
+            } else {
+                m_url.m_userStart = currentPosition(c);
+                state = State::AuthorityOrHost;
+                authorityOrHostBegin = c;
             }
-            m_url.m_userStart = currentPosition(c);
-            state = State::AuthorityOrHost;
-            authorityOrHostBegin = c;
             break;
         case State::AuthorityOrHost:
             do {
@@ -1347,6 +1348,11 @@
                     failure();
                     return;
                 }
+                if (*c == '?' || *c == '#') {
+                    syntaxViolation(c);
+                    appendToASCIIBuffer('/');
+                    m_url.m_pathAfterLastSlash = currentPosition(c);
+                }
                 state = State::Path;
                 break;
             }

Modified: trunk/Tools/ChangeLog (206547 => 206548)


--- trunk/Tools/ChangeLog	2016-09-28 21:12:04 UTC (rev 206547)
+++ trunk/Tools/ChangeLog	2016-09-28 21:14:44 UTC (rev 206548)
@@ -1,5 +1,15 @@
 2016-09-28  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should ignore extra slashes after scheme:// and handle a missing slash after the port
+        https://bugs.webkit.org/show_bug.cgi?id=162690
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2016-09-28  Alex Christensen  <achristen...@webkit.org>
+
         URLParser should correctly canonicalize uppercase IPv6 addresses
         https://bugs.webkit.org/show_bug.cgi?id=162680
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (206547 => 206548)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-28 21:12:04 UTC (rev 206547)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-28 21:14:44 UTC (rev 206548)
@@ -251,6 +251,11 @@
     checkURL("https://@test@test@example:800\\path@end", {"", "", "", "", 0, "", "", "", "https://@test@test@example:800\\path@end"});
     checkURL("http://www.example.com/#a\nb\rc\td", {"http", "", "", "www.example.com", 0, "/", "", "abcd", "http://www.example.com/#abcd"});
     checkURL("http://[A:b:c:DE:fF:0:1:aC]/", {"http", "", "", "[a:b:c:de:ff:0:1:ac]", 0, "/", "", "", "http://[a:b:c:de:ff:0:1:ac]/"});
+    checkURL("http:////////user:@webkit.org:99?foo", {"http", "user", "", "webkit.org", 99, "/", "foo", "", "http://u...@webkit.org:99/?foo"});
+    checkURL("http:////////user:@webkit.org:99#foo", {"http", "user", "", "webkit.org", 99, "/", "", "foo", "http://u...@webkit.org:99/#foo"});
+    checkURL("http:////\t////user:@webkit.org:99?foo", {"http", "user", "", "webkit.org", 99, "/", "foo", "", "http://u...@webkit.org:99/?foo"});
+    checkURL("http://\t//\\///user:@webkit.org:99?foo", {"http", "user", "", "webkit.org", 99, "/", "foo", "", "http://u...@webkit.org:99/?foo"});
+    checkURL("http:/\\user:@webkit.org:99?foo", {"http", "user", "", "webkit.org", 99, "/", "foo", "", "http://u...@webkit.org:99/?foo"});
 
     // This disagrees with the web platform test for http://:@www.example.com but agrees with Chrome and URL::parse,
     // and Firefox fails the web platform test differently. Maybe the web platform test ought to be changed.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to