aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDesmond O. Chang <dochang@gmail.com>2016-04-28 17:33:25 +0800
committerJay Satiro <raysatiro@yahoo.com>2017-03-12 01:32:33 -0500
commitd2bcf1e3e247d116dc96bd3ea32056e3f089449c (patch)
treeda6eb7bec914ef3a31883aa0ddb30ce33c5dde5e /src
parentec1d0ed1c14d1b2ed06d8914c19b3df2da575005 (diff)
url: add option CURLOPT_SUPPRESS_CONNECT_HEADERS
- Add new option CURLOPT_SUPPRESS_CONNECT_HEADERS to allow suppressing proxy CONNECT response headers from the user callback functions CURLOPT_HEADERFUNCTION and CURLOPT_WRITEFUNCTION. - Add new tool option --suppress-connect-headers to expose CURLOPT_SUPPRESS_CONNECT_HEADERS and allow suppressing proxy CONNECT response headers from --dump-header and --include. Assisted-by: Jay Satiro Assisted-by: CarloCannas@users.noreply.github.com Closes https://github.com/curl/curl/pull/783
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.h2
-rw-r--r--src/tool_getparam.c4
-rw-r--r--src/tool_help.c1
-rw-r--r--src/tool_operate.c5
4 files changed, 11 insertions, 1 deletions
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index b05c440e5..b7fe1d340 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -235,6 +235,8 @@ struct OperationConfig {
bool falsestart;
bool path_as_is;
double expect100timeout;
+ bool suppress_connect_headers; /* suppress proxy CONNECT response headers
+ from user callbacks */
struct GlobalConfig *global;
struct OperationConfig *prev;
struct OperationConfig *next; /* Always last in the struct */
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 85d75ae6e..e7ac35476 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -185,6 +185,7 @@ static const struct LongShort aliases[]= {
{"$U", "connect-to", TRUE},
{"$W", "abstract-unix-socket", TRUE},
{"$X", "tls-max", TRUE},
+ {"$Y", "suppress-connect-headers", FALSE},
{"0", "http1.0", FALSE},
{"01", "http1.1", FALSE},
{"02", "http2", FALSE},
@@ -1066,6 +1067,9 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
if(err)
return err;
break;
+ case 'Y': /* --suppress-connect-headers */
+ config->suppress_connect_headers = toggle;
+ break;
}
break;
case '#': /* --progress-bar */
diff --git a/src/tool_help.c b/src/tool_help.c
index f6fe3527b..86d35899a 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -249,6 +249,7 @@ static const char *const helptext[] = {
" --ssl-allow-beast Allow security flaw to improve interop (SSL)",
" --ssl-no-revoke Disable cert revocation checks (WinSSL)",
" --stderr FILE Where to redirect stderr (use \"-\" for stdout)",
+ " --suppress-connect-headers Suppress proxy CONNECT response headers",
" --tcp-nodelay Use the TCP_NODELAY option",
" --tcp-fastopen Use TCP Fast Open",
" -t, --telnet-option OPT=VAL Set telnet option",
diff --git a/src/tool_operate.c b/src/tool_operate.c
index a489b8dbd..8f767152a 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -886,8 +886,11 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* new in libcurl 7.19.4 */
my_setopt_str(curl, CURLOPT_NOPROXY, config->noproxy);
+
+ my_setopt(curl, CURLOPT_SUPPRESS_CONNECT_HEADERS,
+ config->suppress_connect_headers?1L:0L);
}
-#endif
+#endif /* !CURL_DISABLE_PROXY */
my_setopt(curl, CURLOPT_FAILONERROR, config->failonerror?1L:0L);
my_setopt(curl, CURLOPT_UPLOAD, uploadfile?1L:0L);