From abdbd3100f3d42d35730419e1aea02db40f5c214 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 29 Jan 2007 09:26:36 +0000 Subject: - 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. --- lib/http.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/http.c b/lib/http.c index 89509491f..c07053bdd 100644 --- a/lib/http.c +++ b/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) -- cgit v1.2.3