From: Daniel Stenberg Date: Wed, 22 Oct 2025 12:55:32 +0000 (+0200) Subject: ftp: remove the state_saved struct field X-Git-Tag: rc-8_17_0-3~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8f16da712402733609943b5da003af5baa058e6;p=thirdparty%2Fcurl.git ftp: remove the state_saved struct field It was not necessary. Its only purpose was to know if an upload is done, and that information is already available elsewhere. Closes #19192 --- diff --git a/lib/ftp.c b/lib/ftp.c index cd8903e1b3..8025d80f21 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -533,7 +533,7 @@ static CURLcode ftp_initiate_transfer(struct Curl_easy *data, if(result || !connected) return result; - if(ftpc->state_saved == FTP_STOR) { + if(data->state.upload) { /* When we know we are uploading a specified file, we can get the file size prior to the actual upload. */ Curl_pgrsSetUploadSize(data, data->state.infilesize); @@ -2428,7 +2428,7 @@ static CURLcode ftp_state_rest_resp(struct Curl_easy *data, static CURLcode ftp_state_stor_resp(struct Curl_easy *data, struct ftp_conn *ftpc, - int ftpcode, ftpstate instate) + int ftpcode) { CURLcode result = CURLE_OK; @@ -2438,8 +2438,6 @@ static CURLcode ftp_state_stor_resp(struct Curl_easy *data, return CURLE_UPLOAD_FAILED; } - ftpc->state_saved = instate; - /* PORT means we are now awaiting the server to connect to us. */ if(data->set.ftp_use_port) { bool connected; @@ -2541,7 +2539,6 @@ static CURLcode ftp_state_get_resp(struct Curl_easy *data, infof(data, "Getting file with size: %" FMT_OFF_T, size); /* FTP download: */ - ftpc->state_saved = instate; ftpc->retr_size_saved = size; if(data->set.ftp_use_port) { @@ -3142,7 +3139,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data, break; case FTP_STOR: - result = ftp_state_stor_resp(data, ftpc, ftpcode, ftpc->state); + result = ftp_state_stor_resp(data, ftpc, ftpcode); break; case FTP_QUIT: diff --git a/lib/ftp.h b/lib/ftp.h index d06738f113..e09aadabc3 100644 --- a/lib/ftp.h +++ b/lib/ftp.h @@ -150,9 +150,6 @@ struct ftp_conn { < FTP_MAX_DIR_DEPTH */ unsigned char state; /* (ftpstate enum) always use ftp.c:state() to change state! */ - unsigned char state_saved; /* (ftpstate enum) transfer type saved to be - reloaded after data connection is - established */ unsigned char use_ssl; /* if AUTH TLS is to be attempted etc, for FTP or IMAP or POP3 or others! (type: curl_usessl)*/ unsigned char ccc; /* ccc level for this connection */