From 05ee3f187696e2a3ef52eba3a11c180b6e346d1d Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Sat, 5 Jul 2025 15:13:34 +0100 Subject: [PATCH] RequestServer: Wait until initial connection is open for multiplexing By default, if multiple requests start to a newly seen origin, curl will not wait for a connection to open to figure out if the server supports multiplexing and will instead open a new connection for each request (including a new TLS session and such) This is particularly an issue for initial page load, where a complex website could, for example, request tens of items at once (e.g. a bunch of scripts). We can be kinder to servers that support multiplexing by telling curl to wait till an initial connection is established to determine if multiplexing is supported. On my machine and internet connection, this reduces the amount of connections to github.githubassets.com on initial load of https://github.com/LadybirdBrowser/ladybird from 12 to 2. --- Services/RequestServer/ConnectionFromClient.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Services/RequestServer/ConnectionFromClient.cpp b/Services/RequestServer/ConnectionFromClient.cpp index 65e9158db49..838d8d3988b 100644 --- a/Services/RequestServer/ConnectionFromClient.cpp +++ b/Services/RequestServer/ConnectionFromClient.cpp @@ -487,6 +487,7 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString method, URL: set_option(CURLOPT_URL, url.to_string().to_byte_string().characters()); set_option(CURLOPT_PORT, url.port_or_default()); set_option(CURLOPT_CONNECTTIMEOUT, s_connect_timeout_seconds); + set_option(CURLOPT_PIPEWAIT, 1L); bool did_set_body = false;