Skip to content

Commit

Permalink
curl: error on --alt-svc use w/o support
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bagder committed Feb 5, 2020
1 parent faaa63f commit 1cc97ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/tool_getparam.c
Expand Up @@ -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] == '@') {
Expand Down
3 changes: 0 additions & 3 deletions src/tool_operate.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 1cc97ba

Please sign in to comment.