Commit 13ac2938 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

- Made the pingpong timeout code properly deal with the response timeout AND

  the global timeout if set. Also, as was reported in the bug report #2956437
  by Ryan Chan, the time stamp to use as basis for the per command timeout was
  not set properly in the DONE phase for FTP (and not for SMTP) so I fixed
  that just now. This was a regression compared to 7.19.7 due to the
  conversion of FTP code over to the generic pingpong concepts.

  http://curl.haxx.se/bug/view.cgi?id=2956437
parent 8719398d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -6,6 +6,16 @@

                                  Changelog

Daniel Stenberg (2 Mar 2010)
- Made the pingpong timeout code properly deal with the response timeout AND
  the global timeout if set. Also, as was reported in the bug report #2956437
  by Ryan Chan, the time stamp to use as basis for the per command timeout was
  not set properly in the DONE phase for FTP (and not for SMTP) so I fixed
  that just now. This was a regression compared to 7.19.7 due to the
  conversion of FTP code over to the generic pingpong concepts.

  http://curl.haxx.se/bug/view.cgi?id=2956437

Daniel Stenberg (1 Mar 2010)
- Ben Greear provided an update for TFTP that fixes upload.

+3 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ This release includes the following bugfixes:
 o off-by-one in the chunked encoding trailer parser
 o superfluous blocking for OpenSSL-based SSL connects and multi interface
 o TFTP upload
 o FTP timeouts after file transferred completely

This release includes the following known bugs:

@@ -32,6 +33,7 @@ This release would not have looked like this without help, code, reports and
advice from friends like these:

 Steven M. Schweda, Yang Tse, Jack Zhang, Tom Donovan, Martin Hager,
 Daniel Fandrich, Patrick Monnerat, Pat Ray, Wesley Miaw, Ben Greear
 Daniel Fandrich, Patrick Monnerat, Pat Ray, Wesley Miaw, Ben Greear,
 Ryan Chan

        Thanks! (and sorry if I forgot to mention someone)
+1 −0
Original line number Diff line number Diff line
@@ -3071,6 +3071,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
    long old_time = pp->response_time;

    pp->response_time = 60*1000; /* give it only a minute for now */
    pp->response = Curl_tvnow(); /* timeout relative now */

    result = Curl_GetFTPResponse(&nread, conn, &ftpcode);

+19 −14
Original line number Diff line number Diff line
@@ -50,23 +50,28 @@ long Curl_pp_state_timeout(struct pingpong *pp)
  struct connectdata *conn = pp->conn;
  struct SessionHandle *data=conn->data;
  long timeout_ms; /* in milliseconds */
  long timeout2_ms; /* in milliseconds */
  long response_time= (data->set.server_response_timeout)?
    data->set.server_response_timeout: pp->response_time;

  if(data->set.server_response_timeout )
  /* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine
       remaining time.  Also, use pp->response because SERVER_RESPONSE_TIMEOUT
       is supposed to govern the response for any given server response, not
       for the time from connect to the given server response. */
    timeout_ms = data->set.server_response_timeout - /* timeout time */
     remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is
     supposed to govern the response for any given server response, not for
     the time from connect to the given server response. */

  /* Without a requested timeout, we only wait 'response_time' seconds for the
     full response to arrive before we bail out */
  timeout_ms = response_time -
    Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */
  else if(data->set.timeout)

  if(data->set.timeout) {
    /* if timeout is requested, find out how much remaining time we have */
    timeout_ms = data->set.timeout - /* timeout time */
    timeout2_ms = data->set.timeout - /* timeout time */
      Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */
  else
    /* Without a requested timeout, we only wait 'response_time' seconds for
       the full response to arrive before we bail out */
    timeout_ms = pp->response_time -
      Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */

    /* pick the lowest number */
    timeout_ms = CURLMIN(timeout_ms, timeout2_ms);
  }

  return timeout_ms;
}
+5 −1
Original line number Diff line number Diff line
@@ -784,6 +784,10 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,


  if(status == CURLE_OK) {
    struct smtp_conn *smtpc = &conn->proto.smtpc;
    struct pingpong *pp= &smtpc->pp;
    pp->response = Curl_tvnow(); /* timeout relative now */

    state(conn, SMTP_POSTDATA);
    /* run the state-machine