From 2bb33c18a7fb041aa6831846210e4a9bbf45322f Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 27 Oct 2025 14:16:26 +0100 Subject: [PATCH] pingpong: change repsonse timeout to one minute It was previously two minutes by default and sometimes one minute. Removes a struct field. Closes #19254 --- lib/ftp.c | 6 ------ lib/pingpong.c | 4 ++-- lib/pingpong.h | 3 --- lib/urldata.h | 2 +- 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index 5b96f63ad6..3ac8db6813 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -3364,15 +3364,9 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status, * data has been transferred. This happens when doing through NATs etc that * abandon old silent connections. */ - timediff_t old_time = pp->response_time; - - pp->response_time = 60*1000; /* give it only a minute for now */ pp->response = curlx_now(); /* timeout relative now */ - result = getftpresponse(data, &nread, &ftpcode); - pp->response_time = old_time; /* set this back to previous value */ - if(!nread && (CURLE_OPERATION_TIMEDOUT == result)) { failf(data, "control connection looks dead"); ftpc->ctl_valid = FALSE; /* mark control connection as bad */ diff --git a/lib/pingpong.c b/lib/pingpong.c index ac22e2e340..470199a6ff 100644 --- a/lib/pingpong.c +++ b/lib/pingpong.c @@ -50,8 +50,8 @@ timediff_t Curl_pp_state_timeout(struct Curl_easy *data, struct pingpong *pp, bool disconnecting) { timediff_t timeout_ms; /* in milliseconds */ - timediff_t response_time = (data->set.server_response_timeout > 0) ? - data->set.server_response_timeout : pp->response_time; + timediff_t response_time = data->set.server_response_timeout ? + data->set.server_response_timeout : RESP_TIMEOUT; struct curltime now = curlx_now(); /* if CURLOPT_SERVER_RESPONSE_TIMEOUT is set, use that to determine diff --git a/lib/pingpong.h b/lib/pingpong.h index 5db96c4345..bd723b1c9b 100644 --- a/lib/pingpong.h +++ b/lib/pingpong.h @@ -53,8 +53,6 @@ struct pingpong { size_t sendsize; /* total size of the sendthis buffer */ struct curltime response; /* set to Curl_now() when a command has been sent off, used to time-out response reading */ - timediff_t response_time; /* When no timeout is given, this is the amount of - milliseconds we await for a server response. */ struct dynbuf sendbuf; struct dynbuf recvbuf; size_t overflow; /* number of bytes left after a final response line */ @@ -75,7 +73,6 @@ struct pingpong { #define PINGPONG_SETUP(pp,s,e) \ do { \ - (pp)->response_time = RESP_TIMEOUT; \ (pp)->statemachine = s; \ (pp)->endofresp = e; \ } while(0) diff --git a/lib/urldata.h b/lib/urldata.h index 19f96bbc17..f79ccca0ac 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -127,7 +127,7 @@ typedef unsigned int curl_prot_t; #define MAX_IPADR_LEN sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") /* Default FTP/IMAP etc response timeout in milliseconds */ -#define RESP_TIMEOUT (120*1000) +#define RESP_TIMEOUT (60*1000) /* Max string input length is a precaution against abuse and to detect junk input easier and better. */ -- 2.47.3