diff options
author | Maciej Puzio <mx34567@gmail.com> | 2014-02-04 23:48:16 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2014-04-04 17:03:43 +0200 |
commit | 4946ea05e2ae14bd84332bd1fde5e3b5e468cef2 (patch) | |
tree | d0ff69e80dfd2af0a4a758ff47525c0f5efda90c | |
parent | fa0a5e6812f9e460f4f2d9aae0ca9900fd50add4 (diff) |
curl: add --proxy-header
-rw-r--r-- | src/tool_cfgable.c | 1 | ||||
-rw-r--r-- | src/tool_cfgable.h | 1 | ||||
-rw-r--r-- | src/tool_getparam.c | 6 | ||||
-rw-r--r-- | src/tool_operate.c | 6 |
4 files changed, 13 insertions, 1 deletions
diff --git a/src/tool_cfgable.c b/src/tool_cfgable.c index 1e67f54a4..2fdae073f 100644 --- a/src/tool_cfgable.c +++ b/src/tool_cfgable.c @@ -120,6 +120,7 @@ static void free_config_fields(struct OperationConfig *config) curl_slist_free_all(config->prequote); curl_slist_free_all(config->headers); + curl_slist_free_all(config->proxyheaders); if(config->httppost) { curl_formfree(config->httppost); diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h index 451974468..4ef269026 100644 --- a/src/tool_cfgable.h +++ b/src/tool_cfgable.h @@ -143,6 +143,7 @@ struct OperationConfig { curl_TimeCond timecond; time_t condtime; struct curl_slist *headers; + struct curl_slist *proxyheaders; struct curl_httppost *httppost; struct curl_httppost *last_post; struct curl_slist *telnet_options; diff --git a/src/tool_getparam.c b/src/tool_getparam.c index a0be434ca..6d68c5b40 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -222,6 +222,7 @@ static const struct LongShort aliases[]= { {"G", "get", FALSE}, {"h", "help", FALSE}, {"H", "header", TRUE}, + {"Hp", "proxy-header", TRUE}, {"i", "include", FALSE}, {"I", "head", FALSE}, {"j", "junk-session-cookies", FALSE}, @@ -1404,7 +1405,10 @@ ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'H': /* A custom header to append to a list */ - err = add2list(&config->headers, nextarg); + if(subletter == 'p') /* --proxy-header */ + err = add2list(&config->proxyheaders, nextarg); + else + err = add2list(&config->headers, nextarg); if(err) return err; break; diff --git a/src/tool_operate.c b/src/tool_operate.c index 1b7539459..99ec59abe 100644 --- a/src/tool_operate.c +++ b/src/tool_operate.c @@ -947,6 +947,12 @@ static CURLcode operate_do(struct GlobalConfig *global, my_setopt_str(curl, CURLOPT_USERAGENT, config->useragent); my_setopt_slist(curl, CURLOPT_HTTPHEADER, config->headers); + /* new in libcurl 7.36.0 */ + if(config->proxyheaders) { + my_setopt_slist(curl, CURLOPT_PROXYHEADER, config->proxyheaders); + my_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_SEPARATE); + } + /* new in libcurl 7.5 */ my_setopt(curl, CURLOPT_MAXREDIRS, config->maxredirs); |