cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: POST and Expect: header

From: Duncan Wilcox <duncan_at_mclink.it>
Date: Wed, 22 Jan 2003 14:07:36 +0100

> It may not be a very easy fix, but digging in the lib/transfer.c region is
a
> start. The Curl_readwrite() function is what gets called when there's data
to
> read or write and that is thus supposed to now send away the body-part
until
> the 100-header has been received.

I think that the following code starting at lib/transfer.c:1048 might be
misplaced or incomplete:

    /* no read no write, this is a timeout? */
    if (k->write_after_100_header) {
      /* This should allow some time for the header to arrive, but only a
         very short time as otherwise it'll be too much wasted times too
         often. */
      k->write_after_100_header = FALSE;
      FD_SET (conn->writesockfd, &k->writefd); /* write socket */
      k->keepon |= KEEP_WRITE;
      k->wkeepfd = k->writefd;
    }

It's not checking timeout at all, simply reenabling writes immediatly.
Again, sorry if I don't provide a working patch but I'm not too familiar
with what's going on there. I moved this block down to the timeout checking
section below, like this:

  if (data->set.timeout &&
      ((Curl_tvdiff(k->now, k->start)/1000) >= data->set.timeout)) {

    /* no read no write, this is a timeout? */
    if (k->write_after_100_header) {
      /* This should allow some time for the header to arrive, but only a
         very short time as otherwise it'll be too much wasted times too
         often. */
      k->write_after_100_header = FALSE;
      FD_SET (conn->writesockfd, &k->writefd); /* write socket */
      k->keepon |= KEEP_WRITE;
      k->wkeepfd = k->writefd;
    }
    else {
      failf (data, "Operation timed out with %d out of %d bytes received",
             k->bytecount, conn->size);
      return CURLE_OPERATION_TIMEOUTED;
    }
  }

and after this change curl seems to indeed wait for the server "100
Continue" code before sending the POSTed data, the trace no longer shows
tons of "Send data, 0 bytes".

Unfortunately it's not fixing my problem with the IIS server I'm dealing
with, it still complains that I'm not sending multipart/form-data, so maybe
there's something else that's still broken.

Hope this helps.

Duncan

-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
Received on 2003-01-22