1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 17:31:46 -05:00

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
This commit is contained in:
Daniel Stenberg 2020-02-04 17:32:55 +01:00
parent faaa63f323
commit 1cc97ba6e4
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 4 additions and 4 deletions

View File

@ -1278,7 +1278,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case 'b':
switch(subletter) {
case 'a': /* --alt-svc */
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] == '@') {

View File

@ -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) {