1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

- 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
This commit is contained in:
Daniel Stenberg 2010-03-02 13:26:23 +00:00
parent 8719398d05
commit 13ac29382f
5 changed files with 38 additions and 16 deletions

10
CHANGES
View File

@ -6,6 +6,16 @@
Changelog 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) Daniel Stenberg (1 Mar 2010)
- Ben Greear provided an update for TFTP that fixes upload. - Ben Greear provided an update for TFTP that fixes upload.

View File

@ -23,6 +23,7 @@ This release includes the following bugfixes:
o off-by-one in the chunked encoding trailer parser o off-by-one in the chunked encoding trailer parser
o superfluous blocking for OpenSSL-based SSL connects and multi interface o superfluous blocking for OpenSSL-based SSL connects and multi interface
o TFTP upload o TFTP upload
o FTP timeouts after file transferred completely
This release includes the following known bugs: 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: advice from friends like these:
Steven M. Schweda, Yang Tse, Jack Zhang, Tom Donovan, Martin Hager, 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) Thanks! (and sorry if I forgot to mention someone)

View File

@ -3071,6 +3071,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
long old_time = pp->response_time; long old_time = pp->response_time;
pp->response_time = 60*1000; /* give it only a minute for now */ 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); result = Curl_GetFTPResponse(&nread, conn, &ftpcode);

View File

@ -50,23 +50,28 @@ long Curl_pp_state_timeout(struct pingpong *pp)
struct connectdata *conn = pp->conn; struct connectdata *conn = pp->conn;
struct SessionHandle *data=conn->data; struct SessionHandle *data=conn->data;
long timeout_ms; /* in milliseconds */ 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
/* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine remaining time, or use pp->response because SERVER_RESPONSE_TIMEOUT is
remaining time. Also, use pp->response because SERVER_RESPONSE_TIMEOUT supposed to govern the response for any given server response, not for
is supposed to govern the response for any given server response, not the time from connect to the given server response. */
for the time from connect to the given server response. */
timeout_ms = data->set.server_response_timeout - /* timeout time */ /* Without a requested timeout, we only wait 'response_time' seconds for the
Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */ full response to arrive before we bail out */
else if(data->set.timeout) timeout_ms = response_time -
Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */
if(data->set.timeout) {
/* if timeout is requested, find out how much remaining time we have */ /* 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 */ Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */
else
/* Without a requested timeout, we only wait 'response_time' seconds for /* pick the lowest number */
the full response to arrive before we bail out */ timeout_ms = CURLMIN(timeout_ms, timeout2_ms);
timeout_ms = pp->response_time - }
Curl_tvdiff(Curl_tvnow(), pp->response); /* spent time */
return timeout_ms; return timeout_ms;
} }

View File

@ -637,7 +637,7 @@ static CURLcode smtp_init(struct connectdata *conn)
* a part of the easy interface, it will always be TRUE. * a part of the easy interface, it will always be TRUE.
*/ */
static CURLcode smtp_connect(struct connectdata *conn, static CURLcode smtp_connect(struct connectdata *conn,
bool *done) /* see description above */ bool *done) /* see description above */
{ {
CURLcode result; CURLcode result;
struct smtp_conn *smtpc = &conn->proto.smtpc; struct smtp_conn *smtpc = &conn->proto.smtpc;
@ -784,6 +784,10 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
if(status == CURLE_OK) { 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); state(conn, SMTP_POSTDATA);
/* run the state-machine /* run the state-machine