Commit b620e62f authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

- Dmitry Kurochkin moved several struct fields from the connectdata struct to

  the SingleRequest one to make pipelining better. It is a bit tricky to keep
  them in the right place, to keep things related to the actual request or to
  the actual connection in the right place.
parent b3186dee
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6,6 +6,12 @@

                                  Changelog

Daniel S (31 Jan 2008)
- Dmitry Kurochkin moved several struct fields from the connectdata struct to
  the SingleRequest one to make pipelining better. It is a bit tricky to keep
  them in the right place, to keep things related to the actual request or to
  the actual connection in the right place.

Daniel S (29 Jan 2008)
- Dmitry Kurochkin fixed Curl_done() for pipelining, as it could previously
  crash!
+1 −1
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ static CURLcode file_do(struct connectdata *conn, bool *done)
  /* If we have selected NOBODY and HEADER, it means that we only want file
     information. Which for FILE can't be much more than the file size and
     date. */
  if(conn->bits.no_body && data->set.include_header && fstated) {
  if(data->set.opt_no_body && data->set.include_header && fstated) {
    CURLcode result;
    snprintf(buf, sizeof(data->state.buffer),
             "Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
+3 −3
Original line number Diff line number Diff line
@@ -1473,7 +1473,7 @@ static CURLcode ftp_state_post_mdtm(struct connectdata *conn)
  /* If we have selected NOBODY and HEADER, it means that we only want file
     information. Which in FTP can't be much more than the file size and
     date. */
  if(conn->bits.no_body && ftpc->file &&
  if(data->set.opt_no_body && ftpc->file &&
     ftp_need_type(conn, data->set.prefer_ascii)) {
    /* The SIZE command is _not_ RFC 959 specified, and therefor many servers
       may not support it! It is however the only way we have to get a file's
@@ -2007,7 +2007,7 @@ static CURLcode ftp_state_mdtm_resp(struct connectdata *conn,
      /* If we asked for a time of the file and we actually got one as well,
         we "emulate" a HTTP-style header in our output. */

      if(conn->bits.no_body &&
      if(data->set.opt_no_body &&
         ftpc->file &&
         data->set.get_filetime &&
         (data->info.filetime>=0) ) {
@@ -3575,7 +3575,7 @@ CURLcode ftp_perform(struct connectdata *conn,

  DEBUGF(infof(conn->data, "DO phase starts\n"));

  if(conn->bits.no_body) {
  if(conn->data->set.opt_no_body) {
    /* requested no body means no transfer... */
    struct FTP *ftp = conn->data->state.proto.ftp;
    ftp->transfer = FTPTRANSFER_INFO;
+20 −10
Original line number Diff line number Diff line
@@ -842,7 +842,7 @@ static size_t readmoredata(char *buffer,
    return 0;

  /* make sure that a HTTP request is never sent away chunked! */
  conn->bits.forbidchunk = (bool)(http->sending == HTTPSEND_REQUEST);
  conn->data->req.forbidchunk = (bool)(http->sending == HTTPSEND_REQUEST);

  if(http->postsize <= (curl_off_t)fullsize) {
    memcpy(buffer, http->postdata, (size_t)http->postsize);
@@ -1957,7 +1957,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
  if(data->set.str[STRING_CUSTOMREQUEST])
    request = data->set.str[STRING_CUSTOMREQUEST];
  else {
    if(conn->bits.no_body)
    if(data->set.opt_no_body)
      request = (char *)"HEAD";
    else {
      DEBUGASSERT((httpreq > HTTPREQ_NONE) && (httpreq < HTTPREQ_LAST));
@@ -2025,13 +2025,23 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
  ptr = checkheaders(data, "Transfer-Encoding:");
  if(ptr) {
    /* Some kind of TE is requested, check if 'chunked' is chosen */
    conn->bits.upload_chunky =
    data->req.upload_chunky =
      Curl_compareheader(ptr, "Transfer-Encoding:", "chunked");
  }
  else {
    if(httpreq == HTTPREQ_GET)
      conn->bits.upload_chunky = FALSE;
    if(conn->bits.upload_chunky)
    if((conn->protocol&PROT_HTTP) &&
        data->set.upload &&
        (data->set.infilesize == -1) &&
        (data->set.httpversion != CURL_HTTP_VERSION_1_0)) {
      /* HTTP, upload, unknown file size and not HTTP 1.0 */
      data->req.upload_chunky = TRUE;
    }
    else {
      /* else, no chunky upload */
      data->req.upload_chunky = FALSE;
    }

    if(data->req.upload_chunky)
      te = "Transfer-Encoding: chunked\r\n";
  }

@@ -2494,7 +2504,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)

      http->sending = HTTPSEND_BODY;

      if(!conn->bits.upload_chunky) {
      if(!data->req.upload_chunky) {
        /* only add Content-Length if not uploading chunked */
        result = add_bufferf(req_buffer,
                             "Content-Length: %" FORMAT_OFF_T "\r\n",
@@ -2566,7 +2576,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
      else
        postsize = data->set.infilesize;

      if((postsize != -1) && !conn->bits.upload_chunky) {
      if((postsize != -1) && !data->req.upload_chunky) {
        /* only add Content-Length if not uploading chunked */
        result = add_bufferf(req_buffer,
                             "Content-Length: %" FORMAT_OFF_T "\r\n",
@@ -2612,7 +2622,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
          data->set.postfieldsize:
          (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);

      if(!conn->bits.upload_chunky) {
      if(!data->req.upload_chunky) {
        /* We only set Content-Length and allow a custom Content-Length if
           we don't upload data chunked, as RFC2616 forbids us to set both
           kinds of headers (Transfer-Encoding: chunked and Content-Length) */
@@ -2662,7 +2672,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
          if(result)
            return result;

          if(!conn->bits.upload_chunky) {
          if(!data->req.upload_chunky) {
            /* We're not sending it 'chunked', append it to the request
               already now to reduce the number if send() calls */
            result = add_buffer(req_buffer, data->set.postfields,
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
      if(*datap == 0x0a) {
        /* we're now expecting data to come, unless size was zero! */
        if(0 == ch->datasize) {
          if(conn->bits.trailerhdrpresent!=TRUE) {
          if(k->trailerhdrpresent!=TRUE) {
            /* No Trailer: header found - revert to original Curl processing */
            ch->state = CHUNK_STOPCR;

Loading