summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2015-04-23 15:58:21 +0200
committerDaniel Stenberg <daniel@haxx.se>2015-04-28 20:40:58 +0200
commit69a2e8d7ec581695a62527cb2252e7350f314ffa (patch)
tree25700583729b9cc6f6d5cdcdb48dce74748bec2b
parentc71cc7243372008c85971afca0b49ec2bb1f7a06 (diff)
downloadcurl-69a2e8d7ec581695a62527cb2252e7350f314ffa.tar.gz
CURLOPT_HEADEROPT: default to separate
Make the HTTP headers separated by default for improved security and reduced risk for information leakage. Bug: http://curl.haxx.se/docs/adv_20150429.html Reported-by: Yehezkel Horowitz, Oren Souroujon
-rw-r--r--docs/libcurl/opts/CURLOPT_HEADEROPT.312
-rw-r--r--lib/url.c1
-rw-r--r--tests/data/test15272
-rw-r--r--tests/data/test2872
-rw-r--r--tests/libtest/lib1527.c1
5 files changed, 10 insertions, 8 deletions
diff --git a/docs/libcurl/opts/CURLOPT_HEADEROPT.3 b/docs/libcurl/opts/CURLOPT_HEADEROPT.3
index be96d7d88..7776b921a 100644
--- a/docs/libcurl/opts/CURLOPT_HEADEROPT.3
+++ b/docs/libcurl/opts/CURLOPT_HEADEROPT.3
@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
-.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
@@ -31,10 +31,10 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HEADEROPT, long bitmask);
Pass a long that is a bitmask of options of how to deal with headers. The two
mutually exclusive options are:
-\fBCURLHEADER_UNIFIED\fP - keep working as before. This means
-\fICURLOPT_HTTPHEADER(3)\fP headers will be used in requests both to servers
-and proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not
-have any effect.
+\fBCURLHEADER_UNIFIED\fP - the headers specified in
+\fICURLOPT_HTTPHEADER(3)\fP will be used in requests both to servers and
+proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not have
+any effect.
\fBCURLHEADER_SEPARATE\fP - makes \fICURLOPT_HTTPHEADER(3)\fP headers only get
sent to a server and not to a proxy. Proxy headers must be set with
@@ -44,7 +44,7 @@ headers. When doing CONNECT, libcurl will send \fICURLOPT_PROXYHEADER(3)\fP
headers only to the proxy and then \fICURLOPT_HTTPHEADER(3)\fP headers only to
the server.
.SH DEFAULT
-CURLHEADER_UNIFIED
+CURLHEADER_SEPARATE (changed in 7.42.1, ased CURLHEADER_UNIFIED before then)
.SH PROTOCOLS
HTTP
.SH EXAMPLE
diff --git a/lib/url.c b/lib/url.c
index 7dc5c4546..1af859dd2 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -605,6 +605,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
set->ssl_enable_alpn = TRUE;
set->expect_100_timeout = 1000L; /* Wait for a second by default. */
+ set->sep_headers = TRUE; /* separated header lists by default */
return result;
}
diff --git a/tests/data/test1527 b/tests/data/test1527
index ee4887ac5..e8d52794b 100644
--- a/tests/data/test1527
+++ b/tests/data/test1527
@@ -45,7 +45,7 @@ http-proxy
lib1527
</tool>
<name>
-Check same headers are generated without CURLOPT_PROXYHEADER
+Check same headers are generated with CURLOPT_HEADEROPT == CURLHEADER_UNIFIED
</name>
<command>
http://the.old.moo.1527:%HTTPPORT/1527 %HOSTIP:%PROXYPORT
diff --git a/tests/data/test287 b/tests/data/test287
index ec4dfeb05..6772e220f 100644
--- a/tests/data/test287
+++ b/tests/data/test287
@@ -28,7 +28,7 @@ http
HTTP proxy CONNECT with custom User-Agent header
</name>
<command>
-http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/2007" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel
+http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/2015" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel --proxy-header "User-Agent: looser/2007"
</command>
</client>
diff --git a/tests/libtest/lib1527.c b/tests/libtest/lib1527.c
index 280c947e3..1122d8ec0 100644
--- a/tests/libtest/lib1527.c
+++ b/tests/libtest/lib1527.c
@@ -83,6 +83,7 @@ int test(char *URL)
test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
test_setopt(curl, CURLOPT_INFILESIZE, strlen(data));
+ test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
res = curl_easy_perform(curl);