mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 17:31:46 -05:00
alt-svc: the curl command line bits
This commit is contained in:
parent
e1be825453
commit
c51c78dd8d
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
DPAGES = \
|
DPAGES = \
|
||||||
abstract-unix-socket.d \
|
abstract-unix-socket.d \
|
||||||
|
alt-svc.d \
|
||||||
anyauth.d \
|
anyauth.d \
|
||||||
append.d basic.d \
|
append.d basic.d \
|
||||||
cacert.d capath.d \
|
cacert.d capath.d \
|
||||||
|
17
docs/cmdline-opts/alt-svc.d
Normal file
17
docs/cmdline-opts/alt-svc.d
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Long: alt-svc
|
||||||
|
Arg: <file name>
|
||||||
|
Protocols: HTTPS
|
||||||
|
Help: Enable alt-svc with this cache file
|
||||||
|
Added: 7.64.1
|
||||||
|
---
|
||||||
|
WARNING: this option is experiemental. Do not use in production.
|
||||||
|
|
||||||
|
This option enables the alt-svc parser in curl. If the file name points to an
|
||||||
|
existing alt-svc cache file, that will be used. After a completed transfer,
|
||||||
|
the cache will be saved to the file name again if it has been modified.
|
||||||
|
|
||||||
|
Specifiy a "" file name (zero length) to avoid loading/saving and make curl
|
||||||
|
just handle the cache in memory.
|
||||||
|
|
||||||
|
If this option is used several times, curl will load contents from all the
|
||||||
|
files but the the last one will be used for saving.
|
@ -53,6 +53,7 @@ static void free_config_fields(struct OperationConfig *config)
|
|||||||
Curl_safefree(config->random_file);
|
Curl_safefree(config->random_file);
|
||||||
Curl_safefree(config->egd_file);
|
Curl_safefree(config->egd_file);
|
||||||
Curl_safefree(config->useragent);
|
Curl_safefree(config->useragent);
|
||||||
|
Curl_safefree(config->altsvc);
|
||||||
Curl_safefree(config->cookie);
|
Curl_safefree(config->cookie);
|
||||||
Curl_safefree(config->cookiejar);
|
Curl_safefree(config->cookiejar);
|
||||||
Curl_safefree(config->cookiefile);
|
Curl_safefree(config->cookiefile);
|
||||||
|
@ -46,6 +46,7 @@ struct OperationConfig {
|
|||||||
char *cookie; /* single line with specified cookies */
|
char *cookie; /* single line with specified cookies */
|
||||||
char *cookiejar; /* write to this file */
|
char *cookiejar; /* write to this file */
|
||||||
char *cookiefile; /* read from this file */
|
char *cookiefile; /* read from this file */
|
||||||
|
char *altsvc; /* alt-svc cache file name */
|
||||||
bool cookiesession; /* new session? */
|
bool cookiesession; /* new session? */
|
||||||
bool encoding; /* Accept-Encoding please */
|
bool encoding; /* Accept-Encoding please */
|
||||||
bool tr_encoding; /* Transfer-Encoding please */
|
bool tr_encoding; /* Transfer-Encoding please */
|
||||||
|
@ -214,6 +214,7 @@ static const struct LongShort aliases[]= {
|
|||||||
{"a", "append", ARG_BOOL},
|
{"a", "append", ARG_BOOL},
|
||||||
{"A", "user-agent", ARG_STRING},
|
{"A", "user-agent", ARG_STRING},
|
||||||
{"b", "cookie", ARG_STRING},
|
{"b", "cookie", ARG_STRING},
|
||||||
|
{"ba", "alt-svc", ARG_STRING},
|
||||||
{"B", "use-ascii", ARG_BOOL},
|
{"B", "use-ascii", ARG_BOOL},
|
||||||
{"c", "cookie-jar", ARG_STRING},
|
{"c", "cookie-jar", ARG_STRING},
|
||||||
{"C", "continue-at", ARG_STRING},
|
{"C", "continue-at", ARG_STRING},
|
||||||
@ -1244,7 +1245,12 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||||||
/* This specifies the User-Agent name */
|
/* This specifies the User-Agent name */
|
||||||
GetStr(&config->useragent, nextarg);
|
GetStr(&config->useragent, nextarg);
|
||||||
break;
|
break;
|
||||||
case 'b': /* cookie string coming up: */
|
case 'b':
|
||||||
|
switch(subletter) {
|
||||||
|
case 'a': /* --alt-svc */
|
||||||
|
GetStr(&config->altsvc, nextarg);
|
||||||
|
break;
|
||||||
|
default: /* --cookie string coming up: */
|
||||||
if(nextarg[0] == '@') {
|
if(nextarg[0] == '@') {
|
||||||
nextarg++;
|
nextarg++;
|
||||||
}
|
}
|
||||||
@ -1255,6 +1261,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
|
|||||||
}
|
}
|
||||||
/* We have a cookie file to read from! */
|
/* We have a cookie file to read from! */
|
||||||
GetStr(&config->cookiefile, nextarg);
|
GetStr(&config->cookiefile, nextarg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
/* use ASCII/text when transferring */
|
/* use ASCII/text when transferring */
|
||||||
|
@ -48,6 +48,8 @@ struct helptxt {
|
|||||||
static const struct helptxt helptext[] = {
|
static const struct helptxt helptext[] = {
|
||||||
{" --abstract-unix-socket <path>",
|
{" --abstract-unix-socket <path>",
|
||||||
"Connect via abstract Unix domain socket"},
|
"Connect via abstract Unix domain socket"},
|
||||||
|
{" --alt-svc <file name>",
|
||||||
|
"Enable alt-svc with this cache file"},
|
||||||
{" --anyauth",
|
{" --anyauth",
|
||||||
"Pick any authentication method"},
|
"Pick any authentication method"},
|
||||||
{"-a, --append",
|
{"-a, --append",
|
||||||
|
@ -1538,6 +1538,12 @@ static CURLcode operate_do(struct GlobalConfig *global,
|
|||||||
if(config->disallow_username_in_url)
|
if(config->disallow_username_in_url)
|
||||||
my_setopt(curl, CURLOPT_DISALLOW_USERNAME_IN_URL, 1L);
|
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 */
|
/* initialize retry vars for loop below */
|
||||||
retry_sleep_default = (config->retry_delay) ?
|
retry_sleep_default = (config->retry_delay) ?
|
||||||
config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
|
config->retry_delay*1000L : RETRY_SLEEP_DEFAULT; /* ms */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user