Title: [206159] trunk
Revision
206159
Author
achristen...@apple.com
Date
2016-09-20 11:34:19 -0700 (Tue, 20 Sep 2016)

Log Message

URLParser should allow '@' in user
https://bugs.webkit.org/show_bug.cgi?id=162272

Reviewed by Tim Horton.

Source/WebCore:

Covered by a new API test.

* platform/URLParser.cpp:
(WebCore::URLParser::parse):
The spec describes using an "@ flag" and rewinding iterators.  I've implemented the authority parsing
and host parsing a little differently, but this makes it equivalent.

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206158 => 206159)


--- trunk/Source/WebCore/ChangeLog	2016-09-20 18:31:27 UTC (rev 206158)
+++ trunk/Source/WebCore/ChangeLog	2016-09-20 18:34:19 UTC (rev 206159)
@@ -1,5 +1,19 @@
 2016-09-20  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should allow '@' in user
+        https://bugs.webkit.org/show_bug.cgi?id=162272
+
+        Reviewed by Tim Horton.
+
+        Covered by a new API test.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parse):
+        The spec describes using an "@ flag" and rewinding iterators.  I've implemented the authority parsing
+        and host parsing a little differently, but this makes it equivalent.
+
+2016-09-20  Alex Christensen  <achristen...@webkit.org>
+
         URLParser: Fix parsing relative URLs with one slash after the scheme:
         https://bugs.webkit.org/show_bug.cgi?id=162294
 

Modified: trunk/Source/WebCore/platform/URLParser.cpp (206158 => 206159)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-09-20 18:31:27 UTC (rev 206158)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-09-20 18:34:19 UTC (rev 206159)
@@ -1143,7 +1143,15 @@
             LOG_STATE("AuthorityOrHost");
             {
                 if (*c == '@') {
-                    parseAuthority<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, c));
+                    auto lastAt = c;
+                    auto findLastAt = c;
+                    while (!findLastAt.atEnd()) {
+                        if (*findLastAt == '@')
+                            lastAt = findLastAt;
+                        ++findLastAt;
+                    }
+                    parseAuthority<serialized>(CodePointIterator<CharacterType>(authorityOrHostBegin, lastAt));
+                    c = lastAt;
                     incrementIteratorSkippingTabAndNewLine<serialized>(c);
                     authorityOrHostBegin = c;
                     state = State::Host;

Modified: trunk/Tools/ChangeLog (206158 => 206159)


--- trunk/Tools/ChangeLog	2016-09-20 18:31:27 UTC (rev 206158)
+++ trunk/Tools/ChangeLog	2016-09-20 18:34:19 UTC (rev 206159)
@@ -1,5 +1,15 @@
 2016-09-20  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should allow '@' in user
+        https://bugs.webkit.org/show_bug.cgi?id=162272
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2016-09-20  Alex Christensen  <achristen...@webkit.org>
+
         URLParser: Fix parsing relative URLs with one slash after the scheme:
         https://bugs.webkit.org/show_bug.cgi?id=162294
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (206158 => 206159)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-20 18:31:27 UTC (rev 206158)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-20 18:34:19 UTC (rev 206159)
@@ -544,6 +544,9 @@
     checkRelativeURLDifferences("/C|/foo/bar", "file:///tmp/mock/path",
         {"file", "", "", "", 0, "/C:/foo/bar", "", "", "file:///C:/foo/bar"},
         {"file", "", "", "", 0, "/C|/foo/bar", "", "", "file:///C|/foo/bar"});
+    checkRelativeURLDifferences("https://@test@test@example:800/", "http://doesnotmatter/",
+        {"https", "@test@test", "", "example", 800, "/", "", "", "https://%40test%40test@example:800/"},
+        {"", "", "", "", 0, "", "", "", "https://@test@test@example:800/"});
 }
 
 TEST_F(URLParserTest, DefaultPort)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to