cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: proxy tunnel and custom headers

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 22 Jul 2010 23:29:18 +0200 (CEST)

On Thu, 22 Jul 2010, Patricia Muscalu wrote:

> Without supplying Transfer-Encoding header, curl sets Content-Length: -1.

> Giving more details, I send as well the following headers to the HTTP
> server:
> Content-Type: image/jpeg
> Content-Disposition: attachment; filename="image.jpg"

Is that a bit like a multipart formpost? That last header looks unusual to me.

Can you please provide a full example that makes curl set Content-Length: to
-1 in the outgoing request as that sounds like a possible bug or misuse of
libcurl option(s).

> Temporarily, I send Content-length: 0 header with the CONNECT request and
> wait for the 200 Connection Established response
> from the proxy. After the proxy tunnel has been established, I set
> Transfer-Encoding header plus other custom headers according to:

If this works, it is by pure luck. libcurl does not really support changing
options after a handle has already been set in use.

> Is this a correct approach? Is there any other way of achieving this
> behavior?

The file tests/libtest/lib510.c shows how we test POST using
Transfer-Encoding: chunked, but as you can see it _does_ set the header
manually! Is this similar to what you do, but you also use CONNECT through a
proxy (that then gets the Transfer-Encoding: header) ?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-22