summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-02-04 17:32:55 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-02-05 07:57:38 +0100
commit1cc97ba6e42820ad0d8d69ba101b3b830aa1316d (patch)
tree212be68f8db759da2f7afb685f488333500a54a1 /src
parentfaaa63f32359c5e7e91c02ad421105b3e2079d15 (diff)
downloadcurl-1cc97ba6e42820ad0d8d69ba101b3b830aa1316d.tar.gz
curl: error on --alt-svc use w/o support
Make the tool check for alt-svc support at run-time and return error accordingly if not present when the option is used. Reported-by: Harry Sintonen Closes #4878
Diffstat (limited to 'src')
-rw-r--r--src/tool_getparam.c5
-rw-r--r--src/tool_operate.c3
2 files changed, 4 insertions, 4 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 1a72edf3e..764caa203 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -1278,7 +1278,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case 'b':
switch(subletter) {
case 'a': /* --alt-svc */
- GetStr(&config->altsvc, nextarg);
+ if(curlinfo->features & CURL_VERSION_ALTSVC)
+ GetStr(&config->altsvc, nextarg);
+ else
+ return PARAM_LIBCURL_DOESNT_SUPPORT;
break;
default: /* --cookie string coming up: */
if(nextarg[0] == '@') {
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 2855f0f8f..4b3caa80c 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1966,11 +1966,8 @@ static CURLcode single_transfer(struct GlobalConfig *global,
if(config->disallow_username_in_url)
my_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
-#ifdef USE_ALTSVC
- /* only if explicitly enabled in configure */
if(config->altsvc)
my_setopt_str(curl, CURLOPT_ALTSVC, config->altsvc);
-#endif
#ifdef USE_METALINK
if(!metalink && config->use_metalink) {