Title: [272301] trunk/Source
Revision
272301
Author
[email protected]
Date
2021-02-03 00:30:22 -0800 (Wed, 03 Feb 2021)

Log Message

[GTK][WPE] Reduce the use of SoupURI in preparation for libsoup3
https://bugs.webkit.org/show_bug.cgi?id=221251

Reviewed by Adrian Perez de Castro.

Source/WebCore:

* platform/network/soup/AuthenticationChallengeSoup.cpp:
(WebCore::protectionSpaceServerTypeFromURL):
(WebCore::protectionSpaceFromSoupAuthAndURL):
(WebCore::AuthenticationChallenge::AuthenticationChallenge):
(WebCore::protectionSpaceServerTypeFromURI): Deleted.
(WebCore::protectionSpaceFromSoupAuthAndMessage): Deleted.

Source/WebKit:

* UIProcess/API/glib/WebKitURISchemeRequest.cpp:
(webkit_uri_scheme_request_get_scheme):
(webkit_uri_scheme_request_get_path):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_load_uri):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272300 => 272301)


--- trunk/Source/WebCore/ChangeLog	2021-02-03 07:35:00 UTC (rev 272300)
+++ trunk/Source/WebCore/ChangeLog	2021-02-03 08:30:22 UTC (rev 272301)
@@ -1,3 +1,17 @@
+2021-02-03  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Reduce the use of SoupURI in preparation for libsoup3
+        https://bugs.webkit.org/show_bug.cgi?id=221251
+
+        Reviewed by Adrian Perez de Castro.
+
+        * platform/network/soup/AuthenticationChallengeSoup.cpp:
+        (WebCore::protectionSpaceServerTypeFromURL):
+        (WebCore::protectionSpaceFromSoupAuthAndURL):
+        (WebCore::AuthenticationChallenge::AuthenticationChallenge):
+        (WebCore::protectionSpaceServerTypeFromURI): Deleted.
+        (WebCore::protectionSpaceFromSoupAuthAndMessage): Deleted.
+
 2021-02-02  Antti Koivisto  <[email protected]>
 
         Remove the Timer from Style::Scope

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


--- trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp	2021-02-03 07:35:00 UTC (rev 272300)
+++ trunk/Source/WebCore/platform/network/soup/AuthenticationChallengeSoup.cpp	2021-02-03 08:30:22 UTC (rev 272301)
@@ -34,18 +34,18 @@
 
 namespace WebCore {
 
-static ProtectionSpaceServerType protectionSpaceServerTypeFromURI(SoupURI* uri, bool isForProxy)
+static ProtectionSpaceServerType protectionSpaceServerTypeFromURL(const URL& url, bool isForProxy)
 {
-    if (uri->scheme == SOUP_URI_SCHEME_HTTPS)
+    if (url.protocolIs("https"))
         return isForProxy ? ProtectionSpaceProxyHTTPS : ProtectionSpaceServerHTTPS;
-    if (uri->scheme == SOUP_URI_SCHEME_HTTP)
+    if (url.protocolIs("http"))
         return isForProxy ? ProtectionSpaceProxyHTTP : ProtectionSpaceServerHTTP;
-    if (uri->scheme == SOUP_URI_SCHEME_FTP)
+    if (url.protocolIs("ftp"))
         return isForProxy ? ProtectionSpaceProxyFTP : ProtectionSpaceServerFTP;
     return isForProxy ? ProtectionSpaceProxyHTTP : ProtectionSpaceServerHTTP;
 }
 
-static ProtectionSpace protectionSpaceFromSoupAuthAndMessage(SoupAuth* soupAuth, SoupMessage* message)
+static ProtectionSpace protectionSpaceFromSoupAuthAndURL(SoupAuth* soupAuth, const URL& url)
 {
     const char* schemeName = soup_auth_get_scheme_name(soupAuth);
     ProtectionSpaceAuthenticationScheme scheme;
@@ -60,18 +60,17 @@
     else
         scheme = ProtectionSpaceAuthenticationSchemeUnknown;
 
-    SoupURI* soupURI = soup_message_get_uri(message);
-    return ProtectionSpace(String::fromUTF8(soup_uri_get_host(soupURI)), soup_uri_get_port(soupURI),
-        protectionSpaceServerTypeFromURI(soupURI, soup_auth_is_for_proxy(soupAuth)),
+    return ProtectionSpace(url.host().toString(), static_cast<int>(url.port().valueOr(0)),
+        protectionSpaceServerTypeFromURL(url, soup_auth_is_for_proxy(soupAuth)),
         String::fromUTF8(soup_auth_get_realm(soupAuth)), scheme);
 }
 
 AuthenticationChallenge::AuthenticationChallenge(SoupMessage* soupMessage, SoupAuth* soupAuth, bool retrying, AuthenticationClient* client)
-    : AuthenticationChallengeBase(protectionSpaceFromSoupAuthAndMessage(soupAuth, soupMessage),
-        Credential(), // proposedCredentials
-        retrying ? 1 : 0, // previousFailureCount
-        soupMessage, // failureResponse
-        ResourceError::authenticationError(soupMessage))
+    : AuthenticationChallengeBase(protectionSpaceFromSoupAuthAndURL(soupAuth, soupURIToURL(soup_message_get_uri(soupMessage)))
+        , Credential() // proposedCredentials
+        , retrying ? 1 : 0 // previousFailureCount
+        , soupMessage // failureResponse
+        , ResourceError::authenticationError(soupMessage))
     , m_soupMessage(soupMessage)
     , m_soupAuth(soupAuth)
     , m_authenticationClient(client)

Modified: trunk/Source/WebKit/ChangeLog (272300 => 272301)


--- trunk/Source/WebKit/ChangeLog	2021-02-03 07:35:00 UTC (rev 272300)
+++ trunk/Source/WebKit/ChangeLog	2021-02-03 08:30:22 UTC (rev 272301)
@@ -1,3 +1,16 @@
+2021-02-03  Carlos Garcia Campos  <[email protected]>
+
+        [GTK][WPE] Reduce the use of SoupURI in preparation for libsoup3
+        https://bugs.webkit.org/show_bug.cgi?id=221251
+
+        Reviewed by Adrian Perez de Castro.
+
+        * UIProcess/API/glib/WebKitURISchemeRequest.cpp:
+        (webkit_uri_scheme_request_get_scheme):
+        (webkit_uri_scheme_request_get_path):
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkit_web_view_load_uri):
+
 2021-02-02  Per Arne Vollan  <[email protected]>
 
         Register for power notifications in the UI process

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp (272300 => 272301)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp	2021-02-03 07:35:00 UTC (rev 272300)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitURISchemeRequest.cpp	2021-02-03 08:30:22 UTC (rev 272301)
@@ -26,12 +26,9 @@
 #include "WebKitWebContextPrivate.h"
 #include "WebKitWebView.h"
 #include "WebPageProxy.h"
-#include <WebCore/GUniquePtrSoup.h>
 #include <WebCore/HTTPParsers.h>
 #include <WebCore/MIMETypeRegistry.h>
 #include <WebCore/ResourceError.h>
-#include <WebCore/URLSoup.h>
-#include <libsoup/soup.h>
 #include <wtf/glib/GRefPtr.h>
 #include <wtf/glib/RunLoopSourcePriority.h>
 #include <wtf/glib/WTFGType.h>
@@ -64,7 +61,8 @@
 
     RefPtr<WebPageProxy> initiatingPage;
     CString uri;
-    GUniquePtr<SoupURI> soupURI;
+    CString uriScheme;
+    CString uriPath;
 
     GRefPtr<GInputStream> stream;
     uint64_t streamLength;
@@ -106,10 +104,10 @@
 {
     g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
 
-    if (!request->priv->soupURI)
-        request->priv->soupURI = urlToSoupURI(request->priv->task->request().url());
+    if (request->priv->uriScheme.isNull())
+        request->priv->uriScheme = request->priv->task->request().url().protocol().toString().utf8();
 
-    return request->priv->soupURI->scheme;
+    return request->priv->uriScheme.data();
 }
 
 /**
@@ -142,10 +140,10 @@
 {
     g_return_val_if_fail(WEBKIT_IS_URI_SCHEME_REQUEST(request), nullptr);
 
-    if (!request->priv->soupURI)
-        request->priv->soupURI = urlToSoupURI(request->priv->task->request().url());
+    if (request->priv->uriPath.isNull())
+        request->priv->uriPath = request->priv->task->request().url().path().toString().utf8();
 
-    return request->priv->soupURI->path;
+    return request->priv->uriPath.data();
 }
 
 /**

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (272300 => 272301)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2021-02-03 07:35:00 UTC (rev 272300)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2021-02-03 08:30:22 UTC (rev 272301)
@@ -71,12 +71,11 @@
 #include <_javascript_Core/JSRetainPtr.h>
 #include <jsc/JSCContextPrivate.h>
 #include <WebCore/CertificateInfo.h>
-#include <WebCore/GUniquePtrSoup.h>
 #include <WebCore/JSDOMExceptionHandling.h>
 #include <WebCore/PlatformScreen.h>
 #include <WebCore/RefPtrCairo.h>
-#include <WebCore/URLSoup.h>
 #include <glib/gi18n-lib.h>
+#include <libsoup/soup.h>
 #include <wtf/SetForScope.h>
 #include <wtf/URL.h>
 #include <wtf/glib/GRefPtr.h>
@@ -3020,8 +3019,7 @@
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
     g_return_if_fail(uri);
 
-    GUniquePtr<SoupURI> soupURI(soup_uri_new(uri));
-    getPage(webView).loadRequest(soupURIToURL(soupURI.get()));
+    getPage(webView).loadRequest(URL({ }, String::fromUTF8(uri)));
 }
 
 /**
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to