aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-03-03 11:17:52 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-03-03 11:17:52 +0100
commitc51c78dd8d93990d7168a7f6b2410ec437e66939 (patch)
treee45f94c2cf39634c0d4e9a871a13235cdc4d128e /src
parente1be8254534898fccafc5d6cd04f6235f283cfbd (diff)
alt-svc: the curl command line bits
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.c1
-rw-r--r--src/tool_cfgable.h1
-rw-r--r--src/tool_getparam.c25
-rw-r--r--src/tool_help.c2
-rw-r--r--src/tool_operate.c6
5 files changed, 26 insertions, 9 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c
index cf5212bab..fabd6d635 100644
--- a/src/tool_cfgable.c
+++ b/src/tool_cfgable.c
@@ -53,6 +53,7 @@ static void free_config_fields(struct OperationConfig *config)
Curl_safefree(config->random_file);
Curl_safefree(config->egd_file);
Curl_safefree(config->useragent);
+ Curl_safefree(config->altsvc);
Curl_safefree(config->cookie);
Curl_safefree(config->cookiejar);
Curl_safefree(config->cookiefile);
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index 2adfcae23..e374a7f0e 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -46,6 +46,7 @@ struct OperationConfig {
char *cookie; /* single line with specified cookies */
char *cookiejar; /* write to this file */
char *cookiefile; /* read from this file */
+ char *altsvc; /* alt-svc cache file name */
bool cookiesession; /* new session? */
bool encoding; /* Accept-Encoding please */
bool tr_encoding; /* Transfer-Encoding please */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 82ba8b215..b133cb87e 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -214,6 +214,7 @@ static const struct LongShort aliases[]= {
{"a", "append", ARG_BOOL},
{"A", "user-agent", ARG_STRING},
{"b", "cookie", ARG_STRING},
+ {"ba", "alt-svc", ARG_STRING},
{"B", "use-ascii", ARG_BOOL},
{"c", "cookie-jar", ARG_STRING},
{"C", "continue-at", ARG_STRING},
@@ -1244,17 +1245,23 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
/* This specifies the User-Agent name */
GetStr(&config->useragent, nextarg);
break;
- case 'b': /* cookie string coming up: */
- if(nextarg[0] == '@') {
- nextarg++;
- }
- else if(strchr(nextarg, '=')) {
- /* A cookie string must have a =-letter */
- GetStr(&config->cookie, nextarg);
+ case 'b':
+ switch(subletter) {
+ case 'a': /* --alt-svc */
+ GetStr(&config->altsvc, nextarg);
break;
+ default: /* --cookie string coming up: */
+ if(nextarg[0] == '@') {
+ nextarg++;
+ }
+ else if(strchr(nextarg, '=')) {
+ /* A cookie string must have a =-letter */
+ GetStr(&config->cookie, nextarg);
+ break;
+ }
+ /* We have a cookie file to read from! */
+ GetStr(&config->cookiefile, nextarg);
}
- /* We have a cookie file to read from! */
- GetStr(&config->cookiefile, nextarg);
break;
case 'B':
/* use ASCII/text when transferring */
diff --git a/src/tool_help.c b/src/tool_help.c
index 0f6bcd36b..542998bd0 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -48,6 +48,8 @@ struct helptxt {
static const struct helptxt helptext[] = {
{" --abstract-unix-socket <path>",
"Connect via abstract Unix domain socket"},
+ {" --alt-svc <file name>",
+ "Enable alt-svc with this cache file"},
{" --anyauth",
"Pick any authentication method"},
{"-a, --append",
diff --git a/src/tool_operate.c b/src/tool_operate.c
index a8698285d..7f0748753 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -1538,6 +1538,12 @@ static CURLcode operate_do(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
+
/* initialize retry vars for loop below */
retry_sleep_default = (config->retry_delay) ?
config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */