From: Daniel Stenberg Date: Thu, 29 Aug 2024 12:35:21 +0000 (+0200) Subject: ftp: always offer line end conversions X-Git-Tag: curl-8_10_0~83 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eeb7c1280742f5c8;p=thirdparty%2Fcurl.git ftp: always offer line end conversions Previously this functionality was limited to platforms that not already use CRLF as native line endings. TODO: 4.5 ASCII support now considered fixed Closes #14717 --- diff --git a/docs/TODO b/docs/TODO index 11e0e4d3d9..a8162cbd3f 100644 --- a/docs/TODO +++ b/docs/TODO @@ -64,7 +64,6 @@ 4. FTP 4.1 HOST 4.4 Support CURLOPT_PREQUOTE for directories listings - 4.5 ASCII support 4.6 GSSAPI via Windows SSPI 4.7 STAT for LIST without data connection 4.8 Passive transfer could try other IP addresses @@ -568,11 +567,6 @@ https://github.com/curl/curl/issues/8602 -4.5 ASCII support - - FTP ASCII transfers do not follow RFC 959. They do not convert the data - accordingly. - 4.6 GSSAPI via Windows SSPI In addition to currently supporting the SASL GSSAPI mechanism (Kerberos V5) diff --git a/lib/ftp.c b/lib/ftp.c index 38bb4ef4cc..899ec3d593 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -327,7 +327,6 @@ static void freedirs(struct ftp_conn *ftpc) Curl_safefree(ftpc->newhost); } -#ifdef CURL_DO_LINEEND_CONV /*********************************************************************** * * Lineend Conversions @@ -416,7 +415,6 @@ static const struct Curl_cwtype ftp_cw_lc = { sizeof(struct ftp_cw_lc_ctx) }; -#endif /* CURL_DO_LINEEND_CONV */ /*********************************************************************** * * AcceptServerConnect() @@ -4142,27 +4140,22 @@ static CURLcode ftp_do(struct Curl_easy *data, bool *done) CURLcode result = CURLE_OK; struct connectdata *conn = data->conn; struct ftp_conn *ftpc = &conn->proto.ftpc; + /* FTP data may need conversion. */ + struct Curl_cwriter *ftp_lc_writer; *done = FALSE; /* default to false */ ftpc->wait_data_conn = FALSE; /* default to no such wait */ -#ifdef CURL_DO_LINEEND_CONV - { - /* FTP data may need conversion. */ - struct Curl_cwriter *ftp_lc_writer; - - result = Curl_cwriter_create(&ftp_lc_writer, data, &ftp_cw_lc, - CURL_CW_CONTENT_DECODE); - if(result) - return result; + result = Curl_cwriter_create(&ftp_lc_writer, data, &ftp_cw_lc, + CURL_CW_CONTENT_DECODE); + if(result) + return result; - result = Curl_cwriter_add(data, ftp_lc_writer); - if(result) { - Curl_cwriter_free(data, ftp_lc_writer); - return result; - } + result = Curl_cwriter_add(data, ftp_lc_writer); + if(result) { + Curl_cwriter_free(data, ftp_lc_writer); + return result; } -#endif /* CURL_DO_LINEEND_CONV */ if(data->state.wildcardmatch) { result = wc_statemach(data); diff --git a/lib/sendf.c b/lib/sendf.c index 24b90d2ad0..202da555a9 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -1102,11 +1102,7 @@ static CURLcode do_init_reader_stack(struct Curl_easy *data, clen = r->crt->total_length(data, r); /* if we do not have 0 length init, and crlf conversion is wanted, * add the reader for it */ - if(clen && (data->set.crlf -#ifdef CURL_DO_LINEEND_CONV - || data->state.prefer_ascii -#endif - )) { + if(clen && (data->set.crlf || data->state.prefer_ascii)) { result = cr_lc_add(data); if(result) return result; diff --git a/lib/urldata.h b/lib/urldata.h index 04e03ae9a5..2a282beb66 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -105,11 +105,6 @@ typedef unsigned int curl_prot_t; #define CURL_DEFAULT_USER "anonymous" #define CURL_DEFAULT_PASSWORD "ftp@example.com" -#if !defined(_WIN32) && !defined(MSDOS) && !defined(__EMX__) -/* do FTP line-end conversions on most platforms */ -#define CURL_DO_LINEEND_CONV -#endif - /* Convenience defines for checking protocols or their SSL based version. Each protocol handler should only ever have a single CURLPROTO_ in its protocol field. */