mirror of
https://github.com/curl/curl.git
synced 2026-07-30 11:18:04 +03:00
FTP: partly revert eeb7c12807
Since ASCII transfers on FTP means sending CRLF line endings, we should
still keep converting them to LF-only on platforms where text files
typically do not use CRLF.
This also DOES NOT convert existing CRLF line endings on ASCII uploads
but only does stand-alone LF => CRLF.
Regression from eeb7c12807 shipped in 8.10.0
Reported-by: finkjsc on github
Fixes #14873
Closes #14875
This commit is contained in:
parent
2b652b8634
commit
7eda757d99
7 changed files with 54 additions and 19 deletions
27
lib/ftp.c
27
lib/ftp.c
|
|
@ -327,6 +327,7 @@ static void freedirs(struct ftp_conn *ftpc)
|
|||
Curl_safefree(ftpc->newhost);
|
||||
}
|
||||
|
||||
#ifdef CURL_PREFER_LF_LINEENDS
|
||||
/***********************************************************************
|
||||
*
|
||||
* Lineend Conversions
|
||||
|
|
@ -415,6 +416,7 @@ static const struct Curl_cwtype ftp_cw_lc = {
|
|||
sizeof(struct ftp_cw_lc_ctx)
|
||||
};
|
||||
|
||||
#endif /* CURL_PREFER_LF_LINEENDS */
|
||||
/***********************************************************************
|
||||
*
|
||||
* AcceptServerConnect()
|
||||
|
|
@ -4138,22 +4140,27 @@ 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 */
|
||||
|
||||
result = Curl_cwriter_create(&ftp_lc_writer, data, &ftp_cw_lc,
|
||||
CURL_CW_CONTENT_DECODE);
|
||||
if(result)
|
||||
return result;
|
||||
#ifdef CURL_PREFER_LF_LINEENDS
|
||||
{
|
||||
/* FTP data may need conversion. */
|
||||
struct Curl_cwriter *ftp_lc_writer;
|
||||
|
||||
result = Curl_cwriter_add(data, ftp_lc_writer);
|
||||
if(result) {
|
||||
Curl_cwriter_free(data, ftp_lc_writer);
|
||||
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;
|
||||
}
|
||||
}
|
||||
#endif /* CURL_PREFER_LF_LINEENDS */
|
||||
|
||||
if(data->state.wildcardmatch) {
|
||||
result = wc_statemach(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue