- 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:
Daniel Stenberg 2007-01-29 09:26:36 +00:00
parent ddace02efe
commit abdbd3100f
5 changed files with 60 additions and 5 deletions

View file

@ -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)