Question


I'm using libcurl (c++) library to make a request to an IIS 7.5 server. The transaction is a common SOAP webservice

Everything is working fine, my requests send an "Expect 100-continue" flag, and the server responds with a 100-continue and inmediately after that a 200 ok code along with the web service response.

But from time to time, the client receives a 100-continue message and after that, another 100 code. This makes the client report an error, as it expects a final status code right after the server 100 code. I read in W3C HTTP1.1 protocol:

An origin server that sends a 100 (Continue) response MUST ultimately send a final status code, once the request body is received and processed, unless it terminates the transport connection prematurely.

The word "ultimately" makes me loose the track. Is it possible/common that a server sends several 100 codes after a final status code?

If anyone has faced this issue before, can point me to any explanation on how to handle multiple 100 response codes with libcurl?

Thanks in advance

Was it helpful?

Solution

The current spec says this on 100-continue:

The 100 (Continue) status code indicates that the initial part of a request has been received and has not yet been rejected by the server. The server intends to send a final response after the request has been fully received and acted upon.

When the request contains an Expect header field that includes a 100- continue expectation, the 100 response indicates that the server wishes to receive the request payload body, as described in Section 5.1.1. The client ought to continue sending the request and discard the 100 response.

If the request did not contain an Expect header field containing the 100-continue expectation, the client can simply discard this interim response.

The way I read it, it is not supposed to be more than one 100-continue response header and that's why libcurl works like this. I've never seen this (multiple 100 responses) happen and I've been doing HTTP for a while (I am the main developer of curl). To change this behavior I would expect you'd need to patch libcurl slightly to allow for this to happen.

It is not related to CURLOPT_FAILONERROR.

OTHER TIPS

I suspect it's because there is an unhandled error that is not handled by the client properly. Make sure you set the CURLOPT_FAILONERROR flag.

See this SO post for more information.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top