curl-library
Proxy-Connection Header
From: Toshiyuki Maezawa <toshiyuki.maezawa_at_fujixerox.co.jp>
Date: Tue, 04 Jul 2006 17:40:27 +0900 (JST)
Date: Tue, 04 Jul 2006 17:40:27 +0900 (JST)
Hi,
I am trying to do GET/POST request via proxy and I want to add
"Proxy-Connection: close" header in the HTTP request.
Below is my sample code:
--- curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_PROXY, proxy); headers = curl_slist_append(headers, "Proxy-Connection: close"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_perform(curl); --- I compiled it using libcurl/7.15.4, but this sample program sends these two headers in the GET request: "Proxy-Connection: Keep-Alive" and "Proxy-Connection: close". My understanding is that it sends only "Proxy-Connection: close", because a description of CURLOPT_HTTPHEADER in a manual says below. "If you add a header that is otherwise generated and used by libcurl internally, your added one will be used instead." Is this my misunderstanding or a bug? If it is a bug, a patch below seems to fix it. --- http.c.orig 2006-05-06 07:14:40.000000000 +0900 +++ http.c 2006-07-04 16:11:03.629658000 +0900 @@ -1970,7 +1970,7 @@ (data->set.encoding && *data->set.encoding && conn->allocptr.accept_encoding)? conn->allocptr.accept_encoding:"", (data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: <data> */, - (conn->bits.httpproxy && !conn->bits.tunnel_proxy)? + (conn->bits.httpproxy && !conn->bits.tunnel_proxy && !checkheaders(data, "Proxy-Connection:"))? "Proxy-Connection: Keep-Alive\r\n":"", te ); --- ThanksReceived on 2006-07-04