mirror of
https://github.com/curl/curl.git
synced 2026-08-24 20:03:52 +03:00
- Michael Wallner reported that when doing a CONNECT with a custom User-Agent
header, you got _two_ User-Agent headers in the CONNECT request...! Added test case 287 to verify the fix.
This commit is contained in:
parent
ddace02efe
commit
abdbd3100f
5 changed files with 60 additions and 5 deletions
11
lib/http.c
11
lib/http.c
|
|
@ -1101,6 +1101,8 @@ Curl_compareheader(char *headerline, /* line to check */
|
|||
* like any ordinary HTTP request, and not specially crafted like this. This
|
||||
* function only remains here like this for now since the rewrite is a bit too
|
||||
* much work to do at the moment.
|
||||
*
|
||||
* This function is BLOCKING which is nasty for all multi interface using apps.
|
||||
*/
|
||||
|
||||
CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
||||
|
|
@ -1160,15 +1162,18 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
if(CURLE_OK == result) {
|
||||
char *host=(char *)"";
|
||||
const char *proxyconn="";
|
||||
const char *useragent="";
|
||||
|
||||
if(!checkheaders(data, "Host:")) {
|
||||
host = aprintf("Host: %s\r\n", host_port);
|
||||
if(!host)
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
if(!checkheaders(data, "Proxy-Connection:")) {
|
||||
if(!checkheaders(data, "Proxy-Connection:"))
|
||||
proxyconn = "Proxy-Connection: Keep-Alive\r\n";
|
||||
}
|
||||
|
||||
if(!checkheaders(data, "User-Agent:") && data->set.useragent)
|
||||
useragent = conn->allocptr.uagent;
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
/* Send the connect request to the proxy */
|
||||
|
|
@ -1184,7 +1189,7 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
|
|||
host,
|
||||
conn->allocptr.proxyuserpwd?
|
||||
conn->allocptr.proxyuserpwd:"",
|
||||
data->set.useragent?conn->allocptr.uagent:"",
|
||||
useragent,
|
||||
proxyconn);
|
||||
|
||||
if(CURLE_OK == result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue