cURL / Mailing Lists / curl-library / Single Mail


libcurl, squid proxy, failing multipart post

From: <>
Date: Mon, 2 May 2005 14:57:39 -0000

first, thanks for libcurl. i had been beating my head against libwww for a
couple weeks, when i found libcurl. much easier to use, and it actually
seems to work :)

now, my problem:

C app that multipart posts a memory buffer as if it were a file upload,
along with a couple short (<20 chars) textual variables. i have installed
a call-back for libcurl to write to, and i can post and receive the
response into memory just fine. all is well, until i try to pass thru a
squid proxy.

the setup: the posting app (using libcurl 7.11.1) and the http server
(apache 2.0.x/modperl 1.99.x) are both on my desktop machine. the squid
proxy is another machine on the same subnet. if i use mozilla from the
app/server machine to post the same data to the same url as my app, it
works. if i use libcurl in my app, it times out.

i take tcpdump on the proxy, for all packets from the app/server machine.
what i see is:

******* working mozilla **************
mozilla sends http headers and post contents to proxy in 4 sequential
packets. (squid ACK after each). the http headers are split across the
first two packets. it does not use the Expect: header. it is an http 1.1

then, squid opens a connection back to port 80, and sends the request in
three packets quickly, the 3 ACKs appear to come back from apache after
the last. the headers are all in the first packet, the post body is in
two, larger segments, but is otherwise the same. it is an http 1.0 post.

apache returns 200 to squid, the connection is torn down. this is http 1.1

squid returns 200 to the app, the connection is torn down. this is http

********** non-working my app **************
app sends http headers in a single packet, gets an ACK. the post body is
never sent. I do not use the Expect: header.

squid opens a connection to post 80, sends the headers, gets an ack.

then we wait. app times out, and tears down connection to squid.

squid tears down connection to httpd. httpd returns 200 OK during the
teardown, and squid sends RST.


ok, so i am sure this is something i am doing, but it looks like even
though i have Expect: turned off, libcurl is still waiting instead of
sending the post body. i have searched around quite a bit, but did not see
any answers.

things to try? suggestions?

thanks for any help you can give.

Received on 2005-05-02