mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 17:31:46 -05:00
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
This commit is contained in:
parent
1f8a337e41
commit
6ba2e88a64
@ -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
|
.\" * This software is licensed as described in the file COPYING, which
|
||||||
.\" * you should have received as part of this distribution. The terms
|
.\" * 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
|
Pass a long that is a bitmask of options of how to deal with headers. The two
|
||||||
mutually exclusive options are:
|
mutually exclusive options are:
|
||||||
|
|
||||||
\fBCURLHEADER_UNIFIED\fP - keep working as before. This means
|
\fBCURLHEADER_UNIFIED\fP - the headers specified in
|
||||||
\fICURLOPT_HTTPHEADER(3)\fP headers will be used in requests both to servers
|
\fICURLOPT_HTTPHEADER(3)\fP will be used in requests both to servers and
|
||||||
and proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not
|
proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not have
|
||||||
have any effect.
|
any effect.
|
||||||
|
|
||||||
\fBCURLHEADER_SEPARATE\fP - makes \fICURLOPT_HTTPHEADER(3)\fP headers only get
|
\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
|
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
|
headers only to the proxy and then \fICURLOPT_HTTPHEADER(3)\fP headers only to
|
||||||
the server.
|
the server.
|
||||||
.SH DEFAULT
|
.SH DEFAULT
|
||||||
CURLHEADER_UNIFIED
|
CURLHEADER_SEPARATE (changed in 7.42.1, ased CURLHEADER_UNIFIED before then)
|
||||||
.SH PROTOCOLS
|
.SH PROTOCOLS
|
||||||
HTTP
|
HTTP
|
||||||
.SH EXAMPLE
|
.SH EXAMPLE
|
||||||
|
@ -617,6 +617,7 @@ CURLcode Curl_init_userdefined(struct UserDefined *set)
|
|||||||
set->ssl_enable_alpn = TRUE;
|
set->ssl_enable_alpn = TRUE;
|
||||||
|
|
||||||
set->expect_100_timeout = 1000L; /* Wait for a second by default. */
|
set->expect_100_timeout = 1000L; /* Wait for a second by default. */
|
||||||
|
set->sep_headers = TRUE; /* separated header lists by default */
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ http-proxy
|
|||||||
lib1527
|
lib1527
|
||||||
</tool>
|
</tool>
|
||||||
<name>
|
<name>
|
||||||
Check same headers are generated without CURLOPT_PROXYHEADER
|
Check same headers are generated with CURLOPT_HEADEROPT == CURLHEADER_UNIFIED
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<command>
|
||||||
http://the.old.moo.1527:%HTTPPORT/1527 %HOSTIP:%PROXYPORT
|
http://the.old.moo.1527:%HTTPPORT/1527 %HOSTIP:%PROXYPORT
|
||||||
|
@ -28,7 +28,7 @@ http
|
|||||||
HTTP proxy CONNECT with custom User-Agent header
|
HTTP proxy CONNECT with custom User-Agent header
|
||||||
</name>
|
</name>
|
||||||
<command>
|
<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>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ int test(char *URL)
|
|||||||
test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
||||||
test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
|
||||||
test_setopt(curl, CURLOPT_INFILESIZE, strlen(data));
|
test_setopt(curl, CURLOPT_INFILESIZE, strlen(data));
|
||||||
|
test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
|
||||||
|
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user