mirror of
https://github.com/curl/curl.git
synced 2024-12-15 06:40:09 +08:00
setopt: allow HTTP3 when HTTP2 is not defined
Reported-by: Karthikdasari0423 on github Fixes #10538 Closes #10544
This commit is contained in:
parent
85721574ed
commit
72bb489543
44
lib/setopt.c
44
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;
|
||||
#ifdef ENABLE_QUIC
|
||||
if(arg == CURL_HTTP_VERSION_3)
|
||||
;
|
||||
else
|
||||
#endif
|
||||
#ifndef USE_HTTP2
|
||||
if(arg >= CURL_HTTP_VERSION_2)
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
#else
|
||||
if(arg >= CURL_HTTP_VERSION_LAST)
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
if(arg == CURL_HTTP_VERSION_NONE)
|
||||
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
|
||||
case CURL_HTTP_VERSION_3:
|
||||
case CURL_HTTP_VERSION_3ONLY:
|
||||
/* accepted */
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
/* not accepted */
|
||||
if(arg < CURL_HTTP_VERSION_NONE)
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
return CURLE_UNSUPPORTED_PROTOCOL;
|
||||
}
|
||||
data->set.httpwant = (unsigned char)arg;
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user