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
This commit is contained in:
Daniel Stenberg 2024-08-29 14:35:21 +02:00
parent 4becbb4af7
commit eeb7c12807
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 11 additions and 33 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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. */