Title: [206036] trunk
Revision
206036
Author
achristen...@apple.com
Date
2016-09-16 11:59:01 -0700 (Fri, 16 Sep 2016)

Log Message

URLParser should percent encode the user and password according to spec
https://bugs.webkit.org/show_bug.cgi?id=162049

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests based on the web platform tests.

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

Tools:

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (206035 => 206036)


--- trunk/Source/WebCore/ChangeLog	2016-09-16 18:57:07 UTC (rev 206035)
+++ trunk/Source/WebCore/ChangeLog	2016-09-16 18:59:01 UTC (rev 206036)
@@ -1,5 +1,17 @@
 2016-09-16  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should percent encode the user and password according to spec
+        https://bugs.webkit.org/show_bug.cgi?id=162049
+
+        Reviewed by Tim Horton.
+
+        Covered by new API tests based on the web platform tests.
+
+        * platform/URLParser.cpp:
+        (WebCore::URLParser::parseAuthority):
+
+2016-09-16  Alex Christensen  <achristen...@webkit.org>
+
         Fix more edge cases in URLParser
         https://bugs.webkit.org/show_bug.cgi?id=162051
 

Modified: trunk/Source/WebCore/platform/URLParser.cpp (206035 => 206036)


--- trunk/Source/WebCore/platform/URLParser.cpp	2016-09-16 18:57:07 UTC (rev 206035)
+++ trunk/Source/WebCore/platform/URLParser.cpp	2016-09-16 18:59:01 UTC (rev 206036)
@@ -1522,10 +1522,10 @@
             m_buffer.append(':');
             break;
         }
-        m_buffer.append(*iterator);
+        utf8PercentEncode(*iterator, m_buffer, isInUserInfoEncodeSet);
     }
     for (; !iterator.atEnd(); ++iterator)
-        m_buffer.append(*iterator);
+        utf8PercentEncode(*iterator, m_buffer, isInUserInfoEncodeSet);
     m_url.m_passwordEnd = m_buffer.length();
     if (!m_url.m_userEnd)
         m_url.m_userEnd = m_url.m_passwordEnd;

Modified: trunk/Tools/ChangeLog (206035 => 206036)


--- trunk/Tools/ChangeLog	2016-09-16 18:57:07 UTC (rev 206035)
+++ trunk/Tools/ChangeLog	2016-09-16 18:59:01 UTC (rev 206036)
@@ -1,5 +1,15 @@
 2016-09-16  Alex Christensen  <achristen...@webkit.org>
 
+        URLParser should percent encode the user and password according to spec
+        https://bugs.webkit.org/show_bug.cgi?id=162049
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
+        (TestWebKitAPI::TEST_F):
+
+2016-09-16  Alex Christensen  <achristen...@webkit.org>
+
         Fix more edge cases in URLParser
         https://bugs.webkit.org/show_bug.cgi?id=162051
 

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp (206035 => 206036)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-16 18:57:07 UTC (rev 206035)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp	2016-09-16 18:59:01 UTC (rev 206036)
@@ -498,6 +498,16 @@
     checkURLDifferences("http://host/path%2e.%2E",
         {"http", "", "", "host", 0, "/path...", "", "", "http://host/path..."},
         {"http", "", "", "host", 0, "/path%2e.%2E", "", "", "http://host/path%2e.%2E"});
+
+    checkRelativeURLDifferences(wideString(L"http://foo:💩@example.com/bar"), "http://other.com/",
+        {"http", "foo", wideString(L"💩"), "example.com", 0, "/bar", "", "", "http://foo:%f0%9f%92...@example.com/bar"},
+        {"", "", "", "", 0, "", "", "", wideString(L"http://foo:💩@example.com/bar")});
+    checkRelativeURLDifferences("http://&a:foo(b]c@d:2/", "http://example.org/foo/bar",
+        {"http", "&a", "foo(b]c", "d", 2, "/", "", "", "http://&a:foo(b%5Dc@d:2/"},
+        {"", "", "", "", 0, "", "", "", "http://&a:foo(b]c@d:2/"});
+    checkRelativeURLDifferences("http://`{}:`{}@h/`{}?`{}", "http://doesnotmatter/",
+        {"http", "`{}", "`{}", "h", 0, "/%60%7B%7D", "`{}", "", "http://%60%7B%7D:%60%7B%7D@h/%60%7B%7D?`{}"},
+        {"", "", "", "", 0, "", "", "", "http://`{}:`{}@h/`{}?`{}"});
 }
 
 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