diff options
author | Stefan Eissing <stefan@eissing.org> | 2023-02-17 10:17:06 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-02-17 16:12:24 +0100 |
commit | 72bb48954363c4df058fbbef05759d79db82f40d (patch) | |
tree | 1818e8e7083b1ee3930f5a7cc7d893d6805cac44 /lib/setopt.c | |
parent | 85721574ed1fc9662b947f83d6316ddef837e88f (diff) | |
download | curl-72bb48954363c4df058fbbef05759d79db82f40d.tar.gz |
setopt: allow HTTP3 when HTTP2 is not defined
Reported-by: Karthikdasari0423 on github
Fixes #10538
Closes #10544
Diffstat (limited to 'lib/setopt.c')
-rw-r--r-- | lib/setopt.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/lib/setopt.c b/lib/setopt.c index b8fa1b89e..604693ad9 100644 --- a/lib/setopt.c +++ b/lib/setopt.c @@ -895,22 +895,38 @@ CURLcode Curl_vsetopt(struct Curl_easy *data, CURLoption option, va_list param) * the listed enums in curl/curl.h. */ arg = va_arg(param, long); - if(arg < CURL_HTTP_VERSION_NONE) - return CURLE_BAD_FUNCTION_ARGUMENT; + switch(arg) { + case CURL_HTTP_VERSION_NONE: +#ifdef USE_HTTP2 + /* TODO: this seems an undesirable quirk to force a behaviour on + * lower implementations that they should recognize independantly? */ + arg = CURL_HTTP_VERSION_2TLS; +#endif + /* accepted */ + break; + case CURL_HTTP_VERSION_1_0: + case CURL_HTTP_VERSION_1_1: + /* accepted */ + break; +#ifdef USE_HTTP2 + case CURL_HTTP_VERSION_2_0: + case CURL_HTTP_VERSION_2TLS: + case CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE: + /* accepted */ + break; +#endif #ifdef ENABLE_QUIC - if(arg == CURL_HTTP_VERSION_3) - ; - else + case CURL_HTTP_VERSION_3: + case CURL_HTTP_VERSION_3ONLY: + /* accepted */ + break; #endif -#ifndef USE_HTTP2 - if(arg >= CURL_HTTP_VERSION_2) - return CURLE_UNSUPPORTED_PROTOCOL; -#else - if(arg >= CURL_HTTP_VERSION_LAST) + default: + /* not accepted */ + if(arg < CURL_HTTP_VERSION_NONE) + return CURLE_BAD_FUNCTION_ARGUMENT; return CURLE_UNSUPPORTED_PROTOCOL; - if(arg == CURL_HTTP_VERSION_NONE) - arg = CURL_HTTP_VERSION_2TLS; -#endif + } data->set.httpwant = (unsigned char)arg; break; |