curl-library
SIGPIPE when uploading with CURLOPT_READDATA
Date: Wed, 29 Sep 2004 15:59:07 -0400
Hi all-
I have replicated a problem with curl and am wondering if it's been
seen out there... or if anyone has some advice for me.
When doing a POST upload to an HTTP server where the POST size exceeds
the maxRequestLen of the HTTP server, curl is dying with SIGPIPE.
In our case we are using libcurl (7.12.0) via CURLHandle, against a
Win2k machine running IIS 5.0. I don't know if it can be replicated on
other servers at this point in time.
We are uploading with the following setup in libcurl:
mPostFile = fopen("/path/to/myfile", "r");
mResult = curl_easy_setopt(mCURL, CURLOPT_POSTFIELDSIZE, fileSize);
mResult = curl_easy_setopt(mCURL, CURLOPT_POST, 1);
// enable write callback with a FILE*
mResult = curl_easy_setopt(mCURL, CURLOPT_READDATA, mPostFile);
Everything works perfectly when we do not exceed the maxRequestLen on
the server. However, when we go beyond this, the app crashes with a
SIGPIPE.
A tcpflow session shows that after the crash, no more data is received
from the server (ie no response saying "too much data"). I think I find
this a little odd as it would seem that even if libcurl crashes the
server still has probably SENT the data in a way that tcpflow would see
it... but I am not sure.
I have tried to replicate it with a command-line version of the same
post, but it behaves as expected. With tcpflow you can also observe the
IIS server sending back a soap error saying you have sent too much
data.
I am assuming at this point that the problem may be with the
CURLOPT_READDATA function used to perform the upload, but I am not sure
even if curl the app uses this then we should see the same problem
there.
Any advice would be greatly appreciated.
Alan Pinstein
Received on 2004-09-29