cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-1849764 ] libcurl doesn't handle Expect: 100 correctly for some POSTs

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Wed, 12 Dec 2007 18:10:30 -0800

Bugs item #1849764, was opened at 2007-12-13 02:10
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1849764&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: http
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: David Wright (wrightd)
Assigned to: Daniel Stenberg (bagder)
Summary: libcurl doesn't handle Expect: 100 correctly for some POSTs

Initial Comment:
In some cases when doing a POST, curl can end up in a state where it is waiting for a a 100-continue response, but it never sent an Expect: 100-continue header

Here is a description of the conditions this can occur:

1. Reuse a connection that was previously used for a PUT or POST with form fields, leaving data->state.expect100header==1

2. Perform a simple post using a CALLBACK (HTTPREQ_POST) and no post fields.

3. expect100() never gets called on the connection. As a result, the Expect: 100-continue header is never sent, but because data->state.expect100header==1 from the previous request, CURL waits for the timeout before sending the POST body.

The fix is relatively simple. The expect100() call is being made only when postfields are present, moving this call outside that check (so it is used for callback posts) as well cause the header to be added properly (or the data->state.expect100header set to false otherwise).

Before:
      if(data->set.postfields) {

        /* for really small posts we don't use Expect: headers at all, and for
           the somewhat bigger ones we allow the app to disable it */
        if(postsize > TINY_INITIAL_POST_SIZE) {
          result = expect100(data, req_buffer);
          if(result)
            return result;
        }
        else
          data->state.expect100header = FALSE;

After:
        /* for really small posts we don't use Expect: headers at all, and for
           the somewhat bigger ones we allow the app to disable it */
        if(postsize > TINY_INITIAL_POST_SIZE) {
          result = expect100(data, req_buffer);
          if(result)
            return result;
        }
        else
          data->state.expect100header = FALSE;
      if(data->set.postfields) {

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=1849764&group_id=976
Received on 2007-12-13

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET