Title: [273379] trunk
Revision
273379
Author
commit-qu...@webkit.org
Date
2021-02-24 03:43:22 -0800 (Wed, 24 Feb 2021)

Log Message

[SOUP3] Use soup_auth_get_authority() to set the ProtectionSpace host and port
https://bugs.webkit.org/show_bug.cgi?id=222309

Patch by Carlos Garcia Campos <cgar...@igalia.com> on 2021-02-24
Reviewed by Adrian Perez de Castro.

Source/WebCore:

That returns the right values in case of proxy authentication.

* platform/network/soup/AuthenticationChallengeSoup.cpp:
(WebCore::protectionSpaceFromSoupAuthAndURL):

Tools:

It fixes two tests when using libsoup3.

* TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp:
(testWebViewAuthenticationProxy):
(testWebViewAuthenticationProxyHTTPS):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273378 => 273379)


--- trunk/Source/WebCore/ChangeLog	2021-02-24 10:57:33 UTC (rev 273378)
+++ trunk/Source/WebCore/ChangeLog	2021-02-24 11:43:22 UTC (rev 273379)
@@ -1,3 +1,15 @@
+2021-02-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [SOUP3] Use soup_auth_get_authority() to set the ProtectionSpace host and port
+        https://bugs.webkit.org/show_bug.cgi?id=222309
+
+        Reviewed by Adrian Perez de Castro.
+
+        That returns the right values in case of proxy authentication.
+
+        * platform/network/soup/AuthenticationChallengeSoup.cpp:
+        (WebCore::protectionSpaceFromSoupAuthAndURL):
+
 2021-02-24  Frederic Wang  <fw...@igalia.com>
 
         Nullptr crash in CompositeEditCommand::splitTreeToNode via InsertParagraphSeparatorCommand::doApply

Modified: trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp (273378 => 273379)


--- trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp	2021-02-24 10:57:33 UTC (rev 273378)
+++ trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp	2021-02-24 11:43:22 UTC (rev 273379)
@@ -61,7 +61,16 @@
     else
         scheme = ProtectionSpaceAuthenticationSchemeUnknown;
 
-    return ProtectionSpace(url.host().toString(), static_cast<int>(url.port().valueOr(0)),
+#if USE(SOUP2)
+    auto host = url.host();
+    auto port = url.port();
+#else
+    URL authURL({ }, makeString("http://", soup_auth_get_authority(soupAuth)));
+    auto host = authURL.host();
+    auto port = authURL.port();
+#endif
+
+    return ProtectionSpace(host.toString(), static_cast<int>(port.valueOr(0)),
         protectionSpaceServerTypeFromURL(url, soup_auth_is_for_proxy(soupAuth)),
         String::fromUTF8(soup_auth_get_realm(soupAuth)), scheme);
 }

Modified: trunk/Tools/ChangeLog (273378 => 273379)


--- trunk/Tools/ChangeLog	2021-02-24 10:57:33 UTC (rev 273378)
+++ trunk/Tools/ChangeLog	2021-02-24 11:43:22 UTC (rev 273379)
@@ -1,3 +1,16 @@
+2021-02-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [SOUP3] Use soup_auth_get_authority() to set the ProtectionSpace host and port
+        https://bugs.webkit.org/show_bug.cgi?id=222309
+
+        Reviewed by Adrian Perez de Castro.
+
+        It fixes two tests when using libsoup3.
+
+        * TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp:
+        (testWebViewAuthenticationProxy):
+        (testWebViewAuthenticationProxyHTTPS):
+
 2021-02-24  Philippe Normand  <pnorm...@igalia.com>
 
         [Flatpak SDK] PATH for rustc no longer set correctly

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp (273378 => 273379)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp	2021-02-24 10:57:33 UTC (rev 273378)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestAuthentication.cpp	2021-02-24 11:43:22 UTC (rev 273379)
@@ -490,9 +490,14 @@
 {
     test->loadURI(kServer->getURIForPath("/proxy/auth-test.html").data());
     WebKitAuthenticationRequest* request = test->waitForAuthenticationRequest();
+#if USE(SOUP2)
     // FIXME: the uri and host should the proxy ones, not the requested ones.
     ASSERT_CMP_CSTRING(webkit_authentication_request_get_host(request), ==, kServer->baseURL().host().toString().utf8());
     g_assert_cmpuint(webkit_authentication_request_get_port(request), ==, kServer->port());
+#else
+    ASSERT_CMP_CSTRING(webkit_authentication_request_get_host(request), ==, test->m_proxyServer.baseURL().host().toString().utf8());
+    g_assert_cmpuint(webkit_authentication_request_get_port(request), ==, test->m_proxyServer.port());
+#endif
     g_assert_cmpstr(webkit_authentication_request_get_realm(request), ==, "Proxy realm");
     g_assert_cmpint(webkit_authentication_request_get_scheme(request), ==, WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC);
     g_assert_true(webkit_authentication_request_is_for_proxy(request));
@@ -500,8 +505,13 @@
     auto* origin = webkit_authentication_request_get_security_origin(request);
     g_assert_nonnull(origin);
     ASSERT_CMP_CSTRING(webkit_security_origin_get_protocol(origin), ==, kServer->baseURL().protocol().toString().utf8());
+#if USE(SOUP2)
     ASSERT_CMP_CSTRING(webkit_security_origin_get_host(origin), ==, kServer->baseURL().host().toString().utf8());
     g_assert_cmpuint(webkit_security_origin_get_port(origin), ==, kServer->port());
+#else
+    ASSERT_CMP_CSTRING(webkit_security_origin_get_host(origin), ==, test->m_proxyServer.baseURL().host().toString().utf8());
+    g_assert_cmpuint(webkit_security_origin_get_port(origin), ==, test->m_proxyServer.port());
+#endif
     webkit_security_origin_unref(origin);
 }
 
@@ -512,9 +522,14 @@
 
     test->loadURI(httpsServer->getURIForPath("/proxy/auth-test.html").data());
     WebKitAuthenticationRequest* request = test->waitForAuthenticationRequest();
+#if USE(SOUP2)
     // FIXME: the uri and host should the proxy ones, not the requested ones.
     ASSERT_CMP_CSTRING(webkit_authentication_request_get_host(request), ==, httpsServer->baseURL().host().toString().utf8());
     g_assert_cmpuint(webkit_authentication_request_get_port(request), ==, httpsServer->port());
+#else
+    ASSERT_CMP_CSTRING(webkit_authentication_request_get_host(request), ==, test->m_proxyServer.baseURL().host().toString().utf8());
+    g_assert_cmpuint(webkit_authentication_request_get_port(request), ==, test->m_proxyServer.port());
+#endif
     g_assert_cmpstr(webkit_authentication_request_get_realm(request), ==, "Proxy realm");
     g_assert_cmpint(webkit_authentication_request_get_scheme(request), ==, WEBKIT_AUTHENTICATION_SCHEME_HTTP_BASIC);
     g_assert_true(webkit_authentication_request_is_for_proxy(request));
@@ -522,8 +537,13 @@
     auto* origin = webkit_authentication_request_get_security_origin(request);
     g_assert_nonnull(origin);
     ASSERT_CMP_CSTRING(webkit_security_origin_get_protocol(origin), ==, httpsServer->baseURL().protocol().toString().utf8());
+#if USE(SOUP2)
     ASSERT_CMP_CSTRING(webkit_security_origin_get_host(origin), ==, httpsServer->baseURL().host().toString().utf8());
     g_assert_cmpuint(webkit_security_origin_get_port(origin), ==, httpsServer->port());
+#else
+    ASSERT_CMP_CSTRING(webkit_security_origin_get_host(origin), ==, test->m_proxyServer.baseURL().host().toString().utf8());
+    g_assert_cmpuint(webkit_security_origin_get_port(origin), ==, test->m_proxyServer.port());
+#endif
     webkit_security_origin_unref(origin);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to