exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit f580fb2bdbcb91bf9b5c544fe31ceebb7ffd249f
parent e0ffda10b58d3e5f68e744ba06da7a259bacaa24
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat, 25 Jul 2026 14:03:22 +0200

add option to disable HTTP2+3

Diffstat:
Mmeson.build | 4++--
Msrc/include/taler/exchange/common.h | 28++++++++++++++++++++++++++++
Msrc/include/taler/taler_auditor_service.h | 28++++++++++++++++++++++++++++
Msrc/lib/auditor_api_curl_defaults.c | 18++++++++++++++++++
Msrc/lib/exchange_api_curl_defaults.c | 19+++++++++++++++++++
5 files changed, 95 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build @@ -293,8 +293,8 @@ if not get_option('only-doc') ['libtalerkyclogic', '3:0:0'], ['libtalerexchangedb', '2:0:0'], ['libtalerauditordb', '1:0:0'], - ['libtalerexchange', '22:0:0'], - ['libtalerauditor', '0:0:0'], + ['libtalerexchange', '23:0:1'], + ['libtalerauditor', '1:0:1'], ['libtalertesting', '4:0:0'], ['libtalertwistertesting', '0:1:0'], ] diff --git a/src/include/taler/exchange/common.h b/src/include/taler/exchange/common.h @@ -39,6 +39,34 @@ /** + * Global options for HTTP requests made to the exchange. + */ +enum TALER_EXCHANGE_GlobalOptions +{ + + /** + * Use defaults. + */ + TALER_EXCHANGE_GO_NONE = 0, + + /** + * Force use of HTTP/1.1. + */ + TALER_EXCHANGE_GO_FORCE_HTTP1_1 = 1, + +}; + + +/** + * Set global options for HTTP requests made with libtalerexchange. + * + * @param go global options to use + */ +void +TALER_EXCHANGE_setup (enum TALER_EXCHANGE_GlobalOptions go); + + +/** * Forward declaration for the exchange's set of online signing keys and * denomination keys. Several endpoint headers reference this type in their * function signatures; declaring it here keeps those headers self-contained diff --git a/src/include/taler/taler_auditor_service.h b/src/include/taler/taler_auditor_service.h @@ -114,6 +114,34 @@ enum TALER_AUDITOR_VersionCompatibility /** + * Global options for HTTP requests made to the auditor. + */ +enum TALER_AUDITOR_GlobalOptions +{ + + /** + * Use defaults. + */ + TALER_AUDITOR_GO_NONE = 0, + + /** + * Force use of HTTP/1.1. + */ + TALER_AUDITOR_GO_FORCE_HTTP1_1 = 1, + +}; + + +/** + * Set global options for HTTP requests made with libtalerauditor. + * + * @param go global options to use + */ +void +TALER_AUDITOR_setup (enum TALER_AUDITOR_GlobalOptions go); + + +/** * General information about the HTTP response we obtained * from the auditor for a request. */ diff --git a/src/lib/auditor_api_curl_defaults.c b/src/lib/auditor_api_curl_defaults.c @@ -20,8 +20,21 @@ * @author Florian Dold */ #include "taler/taler_curl_lib.h" +#include "taler/taler_auditor_service.h" #include "auditor_api_curl_defaults.h" +/** + * Global options for HTTP requests. + */ +static enum TALER_AUDITOR_GlobalOptions aglobal_options; + + +void +TALER_AUDITOR_setup (enum TALER_AUDITOR_GlobalOptions go) +{ + aglobal_options = go; +} + CURL * TALER_AUDITOR_curl_easy_get_ (const char *url) @@ -50,5 +63,10 @@ TALER_AUDITOR_curl_easy_get_ (const char *url) curl_easy_setopt (eh, CURLOPT_TCP_FASTOPEN, 1L)); + if (TALER_AUDITOR_GO_FORCE_HTTP1_1 & aglobal_options) + GNUNET_assert (CURLE_OK == + curl_easy_setopt (eh, + CURLOPT_HTTP_VERSION, + CURL_HTTP_VERSION_1_1)); return eh; } diff --git a/src/lib/exchange_api_curl_defaults.c b/src/lib/exchange_api_curl_defaults.c @@ -21,6 +21,20 @@ */ #include "taler/taler_curl_lib.h" #include "exchange_api_curl_defaults.h" +#include "taler/exchange/common.h" + + +/** + * Global options for HTTP requests. + */ +static enum TALER_EXCHANGE_GlobalOptions eglobal_options; + + +void +TALER_EXCHANGE_setup (enum TALER_EXCHANGE_GlobalOptions go) +{ + eglobal_options = go; +} CURL * @@ -50,5 +64,10 @@ TALER_EXCHANGE_curl_easy_get_ (const char *url) curl_easy_setopt (eh, CURLOPT_TCP_FASTOPEN, 1L)); + if (TALER_EXCHANGE_GO_FORCE_HTTP1_1 & eglobal_options) + GNUNET_assert (CURLE_OK == + curl_easy_setopt (eh, + CURLOPT_HTTP_VERSION, + CURL_HTTP_VERSION_1_1)); return eh; }