Skip to content

Commit d4efa23

Browse files
Use static port for internal webinspector communication
With this port being dynamic, it's not possible to add specific iptables rules allowing this traffic - and with restrictive rules this traffic may be blocked. Allow selecting the port - controlled by WEBKIT_INSPECTOR_PORT env
1 parent 57c8b7b commit d4efa23

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Source/WebKit/UIProcess/API/glib/WebKitInitialize.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <mutex>
3535
#include <wtf/glib/GRefPtr.h>
3636
#include <wtf/glib/GUniquePtr.h>
37+
#include <wtf/text/StringToIntegerConversion.h>
3738

3839
#if USE(SKIA)
3940
#include <skia/core/SkGraphics.h>
@@ -79,8 +80,11 @@ static void initializeRemoteInspectorServer()
7980

8081
auto inspectorHTTPAddress = parseAddress(httpAddress);
8182
GRefPtr<GSocketAddress> inspectorAddress;
82-
if (inspectorHTTPAddress)
83-
inspectorAddress = adoptGRef(G_SOCKET_ADDRESS(g_inet_socket_address_new(g_inet_socket_address_get_address(G_INET_SOCKET_ADDRESS(inspectorHTTPAddress.get())), 0)));
83+
if (inspectorHTTPAddress) {
84+
String envVar = String::fromLatin1(getenv("WEBKIT_INSPECTOR_PORT"));
85+
auto port = parseInteger<uint16_t>(envVar).value_or(0);
86+
inspectorAddress = adoptGRef(G_SOCKET_ADDRESS(g_inet_socket_address_new(g_inet_socket_address_get_address(G_INET_SOCKET_ADDRESS(inspectorHTTPAddress.get())), port)));
87+
}
8488
else
8589
inspectorAddress = parseAddress(address);
8690
if (!inspectorHTTPAddress && !inspectorAddress) {

0 commit comments

Comments
 (0)