commit 47fa9f0ee4e189804659599621c0decc7ea9911b
parent f2d932d5b9b19076d742cd913bf7fc2842160316
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 11 Aug 2026 23:55:58 +0200
add HTTP1/3 selection logic
Diffstat:
3 files changed, 59 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
@@ -297,7 +297,7 @@ if not get_option('only-doc')
libltversions = [
- ['libdonau', '5:0:0'],
+ ['libdonau', '6:0:1'],
['libdonauutil', '0:0:0'],
['libdonaujson', '1:0:1'],
['libdonaupq', '0:0:0'],
diff --git a/src/include/donau_service.h b/src/include/donau_service.h
@@ -31,6 +31,45 @@
#include <gnunet/gnunet_curl_lib.h>
+/**
+ * Global options for HTTP requests made to the donau.
+ */
+enum DONAU_GlobalOptions
+{
+
+ /**
+ * Use defaults. In particular, this means that HTTP/1.1 is used, as
+ * that is the conservative, best-tested option.
+ */
+ DONAU_GO_NONE = 0,
+
+ /**
+ * Force use of HTTP/1.1. As HTTP/1.1 is already the default, this
+ * flag only matters to override an otherwise given
+ * #DONAU_GO_ENABLE_HTTP3.
+ */
+ DONAU_GO_FORCE_HTTP1_1 = 1,
+
+ /**
+ * Allow the use of HTTP/2 and HTTP/3. Note that HTTP/3 is only
+ * actually enabled if the libcurl we run against is deemed suitable
+ * (see #TALER_curl_set_http_version()). Ignored if
+ * #DONAU_GO_FORCE_HTTP1_1 is also set.
+ */
+ DONAU_GO_ENABLE_HTTP3 = 2,
+
+};
+
+
+/**
+ * Set global options for HTTP requests made with libdonau.
+ *
+ * @param go global options to use
+ */
+void
+DONAU_setup (enum DONAU_GlobalOptions go);
+
+
/* ********************* /keys *********************** */
diff --git a/src/lib/donau_api_curl_defaults.c b/src/lib/donau_api_curl_defaults.c
@@ -21,9 +21,24 @@
* @author Lukas Matyja
*/
+#include <taler/taler_curl_lib.h>
+#include "donau_service.h"
#include "donau_api_curl_defaults.h"
+/**
+ * Global options for HTTP requests.
+ */
+static enum DONAU_GlobalOptions dglobal_options;
+
+
+void
+DONAU_setup (enum DONAU_GlobalOptions go)
+{
+ dglobal_options = go;
+}
+
+
CURL *
DONAU_curl_easy_get_ (const char *url)
{
@@ -59,5 +74,9 @@ DONAU_curl_easy_get_ (const char *url)
curl_easy_setopt (eh,
CURLOPT_TCP_FASTOPEN,
1L));
+ TALER_curl_set_http_version (
+ eh,
+ (0 != (DONAU_GO_ENABLE_HTTP3 & dglobal_options)) &&
+ (0 == (DONAU_GO_FORCE_HTTP1_1 & dglobal_options)));
return eh;
}