cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: behavior during POST

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 7 Oct 2003 00:10:32 +0200 (CEST)

On Mon, 6 Oct 2003, David Byron wrote:

> I'm seeing some behavior I don't expect from curl during an http POST and
> was wondering if anyone can clarify this for me. I've read a bit of RFC
> 2616 but probably not enough to know for sure what's "supposed" to happen.
>
> I invoke curl like this:
>
> $ curl --fail -F File=@<some file> <some url>
>
> From looking at the trace, the server sends back a 100-Continue message, and
> curl proceeds to send the file. One of our tests involves stopping the
> server after it sends the 100-Continue, so curl doesn't receive any more
> data over http. The part that seems odd to me is that curl still has an
> exit code of 0.

That would mean that curl didn't notice anything wrong with the connection.
What exactly does "stopping the server" mean?

> When we leave the server running normally, it responds with a 200-OK message
> after curl sends the entire file.
>
> Is it expected/desirable for curl to return some error if it never gets the
> final OK message?

No. curl always reads the response code, and getting a 404 is just as good for
curl as a 200 is. The HTTP status code does not tell curl about errors, they
are for the humans/programs that run curl.

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-10-07