cURL / Mailing Lists / curl-library / Single Mail


HTTP PUT not receiving peer cgi's error response

From: Andreas Frisch <>
Date: Mon, 18 Mar 2013 12:35:13 +0100

Hi Curlers,

for a few days i've been trying to tackle this issue and Bagder asked me on
IRC to put it up on the ML.
On my server, i'm running a cgi-bin (written in plain c, see minimal testcase
attachment ret_400.c ) which is supposed to handle incoming HTTP PUT uploads.
Under certain conditions (e.g. if argument validation fails) it may set an
HTTP status code 400 and exit. when i use the command line curl utility and
PUT a file to this cgi, i receive the appropriate error code (case 2 in

In my peer application which is supposed to invoke the put operation, i could
never receive the server's error response, instead it kept calling the
READFUNC and upload forever, even though the cgi-bin had already terminated.
i hacked a simple test case (curlputtest.c), which shows that the error status
is very well received if i upload a file with a known size (test-case 4). if
the size is unknown (i generate dummy buffers to simulate our live source use
case), then the problem occurs (test-case 7). when the specified url is
faulty, then the server 404 response is received correctly no matter what
(test-cases 5+8), only when cgi-bin itself generates the status, then i don't
get it.
apparently though, i am doing something wrong in my code, because the cli curl
utility receives the 400 status just fine.

another issue that i'm having:
sp.curl->res = curl_easy_pause(sp.curl->easy, CURLPAUSE_SEND) seems to be
ineffctive too, since the READFUNC is started anyway, neither does it pause if
i return CURL_READFUNC_PAUSE there.

i'd be grateful for any suggestions :)


List admin:

Received on 2013-03-18