|
@@ -1,95 +0,0 @@
|
1
|
|
-From 69a2e8d7ec581695a62527cb2252e7350f314ffa Mon Sep 17 00:00:00 2001
|
2
|
|
-From: Daniel Stenberg <daniel@haxx.se>
|
3
|
|
-Date: Thu, 23 Apr 2015 15:58:21 +0200
|
4
|
|
-Subject: [PATCH] CURLOPT_HEADEROPT: default to separate
|
5
|
|
-
|
6
|
|
-Make the HTTP headers separated by default for improved security and
|
7
|
|
-reduced risk for information leakage.
|
8
|
|
-
|
9
|
|
-Bug: http://curl.haxx.se/docs/adv_20150429.html
|
10
|
|
-Reported-by: Yehezkel Horowitz, Oren Souroujon
|
11
|
|
----
|
12
|
|
- docs/libcurl/opts/CURLOPT_HEADEROPT.3 | 12 ++++++------
|
13
|
|
- lib/url.c | 1 +
|
14
|
|
- tests/data/test1527 | 2 +-
|
15
|
|
- tests/data/test287 | 2 +-
|
16
|
|
- tests/libtest/lib1527.c | 1 +
|
17
|
|
- 5 files changed, 10 insertions(+), 8 deletions(-)
|
18
|
|
-
|
19
|
|
---- a/docs/libcurl/opts/CURLOPT_HEADEROPT.3
|
20
|
|
-+++ b/docs/libcurl/opts/CURLOPT_HEADEROPT.3
|
21
|
|
-@@ -5,7 +5,7 @@
|
22
|
|
- .\" * | (__| |_| | _ <| |___
|
23
|
|
- .\" * \___|\___/|_| \_\_____|
|
24
|
|
- .\" *
|
25
|
|
--.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
|
26
|
|
-+.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
|
27
|
|
- .\" *
|
28
|
|
- .\" * This software is licensed as described in the file COPYING, which
|
29
|
|
- .\" * you should have received as part of this distribution. The terms
|
30
|
|
-@@ -31,10 +31,10 @@ CURLcode curl_easy_setopt(CURL *handle,
|
31
|
|
- Pass a long that is a bitmask of options of how to deal with headers. The two
|
32
|
|
- mutually exclusive options are:
|
33
|
|
-
|
34
|
|
--\fBCURLHEADER_UNIFIED\fP - keep working as before. This means
|
35
|
|
--\fICURLOPT_HTTPHEADER(3)\fP headers will be used in requests both to servers
|
36
|
|
--and proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not
|
37
|
|
--have any effect.
|
38
|
|
-+\fBCURLHEADER_UNIFIED\fP - the headers specified in
|
39
|
|
-+\fICURLOPT_HTTPHEADER(3)\fP will be used in requests both to servers and
|
40
|
|
-+proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not have
|
41
|
|
-+any effect.
|
42
|
|
-
|
43
|
|
- \fBCURLHEADER_SEPARATE\fP - makes \fICURLOPT_HTTPHEADER(3)\fP headers only get
|
44
|
|
- sent to a server and not to a proxy. Proxy headers must be set with
|
45
|
|
-@@ -44,7 +44,7 @@ headers. When doing CONNECT, libcurl wil
|
46
|
|
- headers only to the proxy and then \fICURLOPT_HTTPHEADER(3)\fP headers only to
|
47
|
|
- the server.
|
48
|
|
- .SH DEFAULT
|
49
|
|
--CURLHEADER_UNIFIED
|
50
|
|
-+CURLHEADER_SEPARATE (changed in 7.42.1, ased CURLHEADER_UNIFIED before then)
|
51
|
|
- .SH PROTOCOLS
|
52
|
|
- HTTP
|
53
|
|
- .SH EXAMPLE
|
54
|
|
---- a/lib/url.c
|
55
|
|
-+++ b/lib/url.c
|
56
|
|
-@@ -605,6 +605,7 @@ CURLcode Curl_init_userdefined(struct Us
|
57
|
|
- set->ssl_enable_alpn = TRUE;
|
58
|
|
-
|
59
|
|
- set->expect_100_timeout = 1000L; /* Wait for a second by default. */
|
60
|
|
-+ set->sep_headers = TRUE; /* separated header lists by default */
|
61
|
|
- return result;
|
62
|
|
- }
|
63
|
|
-
|
64
|
|
---- a/tests/data/test1527
|
65
|
|
-+++ b/tests/data/test1527
|
66
|
|
-@@ -45,7 +45,7 @@ http-proxy
|
67
|
|
- lib1527
|
68
|
|
- </tool>
|
69
|
|
- <name>
|
70
|
|
--Check same headers are generated without CURLOPT_PROXYHEADER
|
71
|
|
-+Check same headers are generated with CURLOPT_HEADEROPT == CURLHEADER_UNIFIED
|
72
|
|
- </name>
|
73
|
|
- <command>
|
74
|
|
- http://the.old.moo.1527:%HTTPPORT/1527 %HOSTIP:%PROXYPORT
|
75
|
|
---- a/tests/data/test287
|
76
|
|
-+++ b/tests/data/test287
|
77
|
|
-@@ -28,7 +28,7 @@ http
|
78
|
|
- HTTP proxy CONNECT with custom User-Agent header
|
79
|
|
- </name>
|
80
|
|
- <command>
|
81
|
|
--http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/2007" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel
|
82
|
|
-+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"
|
83
|
|
- </command>
|
84
|
|
- </client>
|
85
|
|
-
|
86
|
|
---- a/tests/libtest/lib1527.c
|
87
|
|
-+++ b/tests/libtest/lib1527.c
|
88
|
|
-@@ -83,6 +83,7 @@ int test(char *URL)
|
89
|
|
- test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
90
|
|
- test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
91
|
|
- test_setopt(curl, CURLOPT_INFILESIZE, strlen(data));
|
92
|
|
-+ test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
|
93
|
|
-
|
94
|
|
- res = curl_easy_perform(curl);
|
95
|
|
-
|