How to handle "100 continue" HTTP message ?

Posted by Stephane on Stack Overflow See other posts from Stack Overflow or by Stephane
Published on 2010-06-03T09:33:42Z Indexed on 2010/06/03 9:34 UTC
Read the original article Hit count: 197

Filed under:
|
|

Hello,

I'm writing a simplistic HTTP server that will accept PUT requests mostly from cURL as client and I'm having a bit of an issue with handling the "Expect: 100-continue" header.

As I understand it, the server is supposed to read the header, send back a "HTTP/1.1 100 Continue" response on the connection, read the stream up to the value on "Content-Length" and then send back the real response code (Usually "HTTP/1.1 200 OK" but any other valid HTTP answer should do).

Well, that's exactly what my server does. The problem is that, apparently, if I send a "100 Continue" answer, cURL fails to report any subsequent HTTP error code and assumes the upload was a success. For instance, if the upload is rejected due to the nature of the content (there is a basic data check happening), I want the calling client to detect the problem and act accordingly.

Am I missing something obvious ?

Thanks

© Stack Overflow or respective owner

Related posts about http

Related posts about post