Title: [271794] trunk/Tools
Revision
271794
Author
commit-qu...@webkit.org
Date
2021-01-25 07:08:51 -0800 (Mon, 25 Jan 2021)

Log Message

Unreviewed, reverting r270074 and r270170.
https://bugs.webkit.org/show_bug.cgi?id=220922

Broke all GLib unit tests using a SoupServer

Reverted changesets:

"[GTK] Migrate WebKitTestServer to libsoup 2.48 API"
https://bugs.webkit.org/show_bug.cgi?id=219160
https://trac.webkit.org/changeset/270074

"[GTK] Allow WebKitTestServer to run non-loopback addresses
for API tests"
https://bugs.webkit.org/show_bug.cgi?id=219257
https://trac.webkit.org/changeset/270170

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (271793 => 271794)


--- trunk/Tools/ChangeLog	2021-01-25 13:40:30 UTC (rev 271793)
+++ trunk/Tools/ChangeLog	2021-01-25 15:08:51 UTC (rev 271794)
@@ -1,3 +1,21 @@
+2021-01-25  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r270074 and r270170.
+        https://bugs.webkit.org/show_bug.cgi?id=220922
+
+        Broke all GLib unit tests using a SoupServer
+
+        Reverted changesets:
+
+        "[GTK] Migrate WebKitTestServer to libsoup 2.48 API"
+        https://bugs.webkit.org/show_bug.cgi?id=219160
+        https://trac.webkit.org/changeset/270074
+
+        "[GTK] Allow WebKitTestServer to run non-loopback addresses
+        for API tests"
+        https://bugs.webkit.org/show_bug.cgi?id=219257
+        https://trac.webkit.org/changeset/270170
+
 2021-01-25  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         DumpRenderTree behaves differently to WebKitTestRunner wrt integrated/discrete GPU behavior

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp (271793 => 271794)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp	2021-01-25 13:40:30 UTC (rev 271793)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestSSL.cpp	2021-01-25 15:08:51 UTC (rev 271794)
@@ -554,12 +554,10 @@
 
 void beforeAll()
 {
-    // FIXME(https://webkit.org/b/219198): This should really be a non-localhost domain but
-    // relying on a non-loopback IP address is enough until bug 171934 is fixed.
-    kHttpsServer = new WebKitTestServer(WebKitTestServer::ServerHTTPS | WebKitTestServer::ServerNonLoopback);
+    kHttpsServer = new WebKitTestServer(WebKitTestServer::ServerHTTPS);
     kHttpsServer->run(httpsServerCallback);
 
-    kHttpServer = new WebKitTestServer();
+    kHttpServer = new WebKitTestServer(WebKitTestServer::ServerHTTP);
     kHttpServer->run(httpServerCallback);
 
     SSLTest::add("WebKitWebView", "ssl", testSSL);

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp (271793 => 271794)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp	2021-01-25 13:40:30 UTC (rev 271793)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.cpp	2021-01-25 15:08:51 UTC (rev 271794)
@@ -24,9 +24,9 @@
 #include <wtf/Threading.h>
 #include <wtf/glib/GUniquePtr.h>
 
-WebKitTestServer::WebKitTestServer(ServerOptionsBitSet options)
+WebKitTestServer::WebKitTestServer(ServerOptions options)
 {
-    if (options[ServerRunInThread]) {
+    if (options & ServerRunInThread) {
         WTF::initialize();
         m_queue = WorkQueue::create("WebKitTestServer");
     }
@@ -33,35 +33,21 @@
 
     GUniquePtr<char> sslCertificateFile;
     GUniquePtr<char> sslKeyFile;
-    if (options[ServerHTTPS]) {
+    if (options & ServerHTTPS) {
         CString resourcesDir = Test::getResourcesDir();
         sslCertificateFile.reset(g_build_filename(resourcesDir.data(), "test-cert.pem", NULL));
         sslKeyFile.reset(g_build_filename(resourcesDir.data(), "test-key.pem", NULL));
     }
 
-    m_soupServer = adoptGRef(soup_server_new(
+    GRefPtr<SoupAddress> address = adoptGRef(soup_address_new("127.0.0.1", SOUP_ADDRESS_ANY_PORT));
+    soup_address_resolve_sync(address.get(), 0);
+
+    m_soupServer = adoptGRef(soup_server_new(SOUP_SERVER_INTERFACE, address.get(),
         SOUP_SERVER_ASYNC_CONTEXT, m_queue ? m_queue->runLoop().mainContext() : nullptr,
         SOUP_SERVER_SSL_CERT_FILE, sslCertificateFile.get(),
         SOUP_SERVER_SSL_KEY_FILE, sslKeyFile.get(), nullptr));
-
-    GUniqueOutPtr<GError> error;
-    SoupServerListenOptions serverOptions = static_cast<SoupServerListenOptions>(options[ServerHTTPS] ? SOUP_SERVER_LISTEN_IPV4_ONLY : SOUP_SERVER_LISTEN_IPV4_ONLY | SOUP_SERVER_LISTEN_HTTPS);
-    bool serverStarted = false;
-    if (options[ServerNonLoopback]) {
-        GRefPtr<SoupAddress> address = adoptGRef(soup_address_new("localhost", SOUP_ADDRESS_ANY_PORT));
-        soup_address_resolve_sync(address.get(), nullptr);
-        serverStarted = soup_server_listen(m_soupServer.get(), soup_address_get_gsockaddr(address.get()), serverOptions, &error.outPtr());
-    } else
-        serverStarted = soup_server_listen_local(m_soupServer.get(), SOUP_ADDRESS_ANY_PORT, serverOptions, &error.outPtr());
-    if (!serverStarted) {
-        WTFLogAlways("Failed to start HTTP server: %s", error->message);
-        CRASH();
-    }
-
-    GSList* uris = soup_server_get_uris(m_soupServer.get());
-    ASSERT(uris);
-    m_baseURI = static_cast<SoupURI*>(g_object_ref(uris->data));
-    g_slist_free_full(uris, g_object_unref);
+    m_baseURI = options & ServerHTTPS ? soup_uri_new("https://127.0.0.1/") : soup_uri_new("http://127.0.0.1/");
+    soup_uri_set_port(m_baseURI, soup_server_get_port(m_soupServer.get()));
 }
 
 WebKitTestServer::~WebKitTestServer()

Modified: trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h (271793 => 271794)


--- trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h	2021-01-25 13:40:30 UTC (rev 271793)
+++ trunk/Tools/TestWebKitAPI/glib/WebKitGLib/WebKitTestServer.h	2021-01-25 15:08:51 UTC (rev 271794)
@@ -19,7 +19,6 @@
 
 #pragma once
 
-#include <bitset>
 #include <libsoup/soup.h>
 #include <wtf/WorkQueue.h>
 #include <wtf/glib/GRefPtr.h>
@@ -30,13 +29,12 @@
 public:
 
     enum ServerOptions {
-        ServerHTTPS = 0,
-        ServerRunInThread = 1,
-        ServerNonLoopback = 2,
+        ServerHTTP = 0,
+        ServerHTTPS = 1 << 1,
+        ServerRunInThread = 1 << 2,
     };
-    using ServerOptionsBitSet = std::bitset<3>;
 
-    WebKitTestServer(ServerOptionsBitSet = 0);
+    WebKitTestServer(ServerOptions = ServerHTTP);
     virtual ~WebKitTestServer();
 
     SoupURI* baseURI() const { return m_baseURI; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to