cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: proxy's response to CONNECT included with server's response

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 5 Oct 2005 20:04:55 +0200 (CEST)

On Wed, 5 Oct 2005, Dave Pierson wrote:

> Currently, the proxy's response to the CONNECT is written to the libcurl
> callback function like the rest of the response, such that it appears before
> the remote server's response headers.

Correct, I made it do that to allow an application to "see" all headers
libcurl receives, including those from a proxy.

> The best method I have thought of for detecting whether the response
> contains a header like this (with a proxy's CONNECT response first) is to
> set a header callback and see if I get an empty header line in the middle of
> the headers. I haven't actually tested this solution yet.

I think that would work. It only has the downside that if there is no proxy or
if it isn't HTTPS, you won't get any proxy headers and thus no newline
separation.

> I have an old version of the curl command-line tool (7.10.6) which appears
> to have worked this way -- stripping the proxy's CONNECT request such that
> the headers dumped with -D are only those from the remote server. So
> presumably the behavior was changed intentionally at some point, or there is
> an option in libcurl which I am missing.

Yes, it was modified before the 7.11.1 release in March 2004.

> Assuming there is no option currently, perhaps one could be added to libcurl
> to specify whether the client wants to ignore the proxy's CONNECT response
> if it was successful?

A fait suggestion.

It could be done either by setting a special 'userp' pointer for the proxy
headers (to allow the app to sort out what kind of headers it is), or by
having a special option that says "no proxy http headers thanks" or similar.
Ideas are welcome!

> Are there any other solutions I'm missing?

Not that I can think of.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-10-05