From daa2bc82bc0ddc17fd2b72781f1c740a5a7b264c Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sun, 7 Jun 2026 15:57:07 +0200 Subject: [PATCH] libstore: warn if http3 && !http2 curl does not support this configuration. we can't easily change the config setup to mirror how curl works, but we *can* print a warning. fixes #1223 Change-Id: Iaa1583275d9cc9e5eed5552210db183a8e0628c8 --- lix/libstore/file-transfer-settings/http2.md | 1 + lix/libstore/file-transfer-settings/http3.md | 1 + lix/libstore/filetransfer.cc | 7 +++++++ 3 files changed, 9 insertions(+) diff --git a/lix/libstore/file-transfer-settings/http2.md b/lix/libstore/file-transfer-settings/http2.md index b485d9844..1133e78f3 100644 --- a/lix/libstore/file-transfer-settings/http2.md +++ b/lix/libstore/file-transfer-settings/http2.md @@ -5,3 +5,4 @@ type: bool default: true --- Whether to enable HTTP/2 support. +HTTP/2 support cannot be disabled if HTTP/3 support is enabled, the `http2` setting will be ignored in this case. diff --git a/lix/libstore/file-transfer-settings/http3.md b/lix/libstore/file-transfer-settings/http3.md index a37b5bc42..df4130714 100644 --- a/lix/libstore/file-transfer-settings/http3.md +++ b/lix/libstore/file-transfer-settings/http3.md @@ -5,3 +5,4 @@ type: bool default: false --- Whether to enable HTTP/3 support. +Enabling HTTP/3 support forcibly enables HTTP/2 as well; the `http2` will be ignored in this case. diff --git a/lix/libstore/filetransfer.cc b/lix/libstore/filetransfer.cc index 06522e0c8..d1d38e2d5 100644 --- a/lix/libstore/filetransfer.cc +++ b/lix/libstore/filetransfer.cc @@ -23,6 +23,7 @@ #include #include #include +#include #if ENABLE_DTRACE #include "trace-probes.gen.hh" @@ -196,6 +197,12 @@ struct TransferItem ); curl_easy_setopt(req.get(), CURLOPT_PIPEWAIT, 1); if (fileTransferSettings.enableHttp3) { + if (!fileTransferSettings.enableHttp2) { + static std::once_flag warningPrinted; + std::call_once(warningPrinted, [] { + printTaggedWarning("http3 implies http2; ignoring explicit http2 setting."); + }); + } curl_easy_setopt(req.get(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_3); } else if (fileTransferSettings.enableHttp2) { curl_easy_setopt(req.get(), CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);