diff --git a/Meta/CMake/vcpkg/overlay-ports/curl/portfile.cmake b/Meta/CMake/vcpkg/overlay-ports/curl/portfile.cmake index acace7742e..145ccdc923 100644 --- a/Meta/CMake/vcpkg/overlay-ports/curl/portfile.cmake +++ b/Meta/CMake/vcpkg/overlay-ports/curl/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS FEATURES http2 USE_NGHTTP2 + http3 USE_NGTCP2 wolfssl CURL_USE_WOLFSSL openssl CURL_USE_OPENSSL mbedtls CURL_USE_MBEDTLS diff --git a/Meta/CMake/vcpkg/overlay-ports/curl/vcpkg.json b/Meta/CMake/vcpkg/overlay-ports/curl/vcpkg.json index 5ba1727c37..0f463941cb 100644 --- a/Meta/CMake/vcpkg/overlay-ports/curl/vcpkg.json +++ b/Meta/CMake/vcpkg/overlay-ports/curl/vcpkg.json @@ -65,12 +65,31 @@ "name": "curl", "default-features": false, "features": [ - "ssl" + "openssl" ] }, "nghttp2" ] }, + "http3": { + "description": "HTTP3 support", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "openssl" + ] + }, + "nghttp3", + { + "name": "ngtcp2", + "features": [ + "openssl" + ] + } + ] + }, "httpsrr": { "description": "enable support for HTTPS RR" }, @@ -125,7 +144,7 @@ ] }, "non-http": { - "description": "Enables protocols beyond HTTP/HTTPS/HTTP2" + "description": "Enables protocols beyond HTTP/HTTPS/HTTP2/HTTP3" }, "openssl": { "description": "SSL support (OpenSSL)", diff --git a/Services/RequestServer/ConnectionFromClient.cpp b/Services/RequestServer/ConnectionFromClient.cpp index 838d8d3988..730182af50 100644 --- a/Services/RequestServer/ConnectionFromClient.cpp +++ b/Services/RequestServer/ConnectionFromClient.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -315,6 +316,8 @@ ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr transpo { s_connections.set(client_id(), *this); + m_alt_svc_cache_path = ByteString::formatted("{}/Ladybird/alt-svc-cache.txt", Core::StandardPaths::user_data_directory()); + m_curl_multi = curl_multi_init(); auto set_option = [this](auto option, auto value) { @@ -488,6 +491,7 @@ void ConnectionFromClient::start_request(i32 request_id, ByteString method, URL: set_option(CURLOPT_PORT, url.port_or_default()); set_option(CURLOPT_CONNECTTIMEOUT, s_connect_timeout_seconds); set_option(CURLOPT_PIPEWAIT, 1L); + set_option(CURLOPT_ALTSVC, m_alt_svc_cache_path.characters()); bool did_set_body = false; diff --git a/Services/RequestServer/ConnectionFromClient.h b/Services/RequestServer/ConnectionFromClient.h index 87d2550d51..bd9a8cfd24 100644 --- a/Services/RequestServer/ConnectionFromClient.h +++ b/Services/RequestServer/ConnectionFromClient.h @@ -70,6 +70,7 @@ private: HashMap> m_read_notifiers; HashMap> m_write_notifiers; NonnullRefPtr m_resolver; + ByteString m_alt_svc_cache_path; }; // FIXME: Find a good home for this diff --git a/vcpkg.json b/vcpkg.json index c2e30ad6c5..e47384033e 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -14,9 +14,12 @@ }, { "name": "curl", + "default-features": false, "features": [ "brotli", + "non-http", "http2", + "http3", "openssl", "websockets" ]