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.
This commit is contained in:
Luke Wilde 2025-07-05 15:13:34 +01:00 committed by Ali Mohammad Pur
commit 05ee3f1876
Notes: github-actions[bot] 2025-07-07 12:12:41 +00:00

View file

@ -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;