]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: return error when asked to use an unsupported HTTP version
authorDaniel Stenberg <daniel@haxx.se>
Sat, 15 Jul 2023 12:00:09 +0000 (14:00 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 15 Jul 2023 17:02:20 +0000 (19:02 +0200)
When one of the following options are used but the libcurl in use does
not support it:

--http2
--http2-prior-knowledge
--proxy-http2

Closes #11440

src/tool_getparam.c
src/tool_libinfo.c
src/tool_libinfo.h

index 25d6acacb8273e52d60470e0192600279a780cc5..ac1a98cc7aa3337e26c83c6e2d6b92233a0f9dbe 100644 (file)
@@ -1438,10 +1438,14 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         break;
       case '2':
         /* HTTP version 2.0 */
+        if(!feature_http2)
+          return PARAM_LIBCURL_DOESNT_SUPPORT;
         sethttpver(global, config, CURL_HTTP_VERSION_2_0);
         break;
       case '3': /* --http2-prior-knowledge */
         /* HTTP version 2.0 over clean TCP */
+        if(!feature_http2)
+          return PARAM_LIBCURL_DOESNT_SUPPORT;
         sethttpver(global, config, CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE);
         break;
       case '4': /* --http3 */
@@ -1462,6 +1466,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         break;
       case 'a':
         /* --proxy-http2 */
+        if(!feature_httpsproxy || !feature_http2)
+          return PARAM_LIBCURL_DOESNT_SUPPORT;
         config->proxyver = CURLPROXY_HTTPS2;
         break;
       }
index fc23adc281da6444fa2c8661349c19c15f3d4d92..a2d30fc520f3f4cc46e7c7b3e40b157963e2ab9a 100644 (file)
@@ -73,6 +73,7 @@ bool feature_brotli = FALSE;
 bool feature_hsts = FALSE;
 bool feature_http2 = FALSE;
 bool feature_http3 = FALSE;
+bool feature_httpsproxy = FALSE;
 bool feature_libz = FALSE;
 bool feature_ntlm = FALSE;
 bool feature_ntlm_wb = FALSE;
@@ -97,7 +98,7 @@ static struct feature_name_presentp {
   {"HSTS",           &feature_hsts,       CURL_VERSION_HSTS},
   {"HTTP2",          &feature_http2,      CURL_VERSION_HTTP2},
   {"HTTP3",          &feature_http3,      CURL_VERSION_HTTP3},
-  {"HTTPS-proxy",    NULL,                CURL_VERSION_HTTPS_PROXY},
+  {"HTTPS-proxy",    &feature_httpsproxy, CURL_VERSION_HTTPS_PROXY},
   {"IDN",            NULL,                CURL_VERSION_IDN},
   {"IPv6",           NULL,                CURL_VERSION_IPV6},
   {"Kerberos",       NULL,                CURL_VERSION_KERBEROS5},
index f9c24070744499b49479c12542631c45d443e126..4937e4f3aa6e566bec466a9adb859de9f3606e9a 100644 (file)
@@ -50,6 +50,7 @@ extern bool feature_brotli;
 extern bool feature_hsts;
 extern bool feature_http2;
 extern bool feature_http3;
+extern bool feature_httpsproxy;
 extern bool feature_libz;
 extern bool feature_ntlm;
 extern bool feature_ntlm_wb;