]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftp: always offer line end conversions
authorDaniel Stenberg <daniel@haxx.se>
Thu, 29 Aug 2024 12:35:21 +0000 (14:35 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 29 Aug 2024 18:24:37 +0000 (20:24 +0200)
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

docs/TODO
lib/ftp.c
lib/sendf.c
lib/urldata.h

index 11e0e4d3d94886fa481cb75b36de71cb96150313..a8162cbd3fdd69fd585f656266e9c36ac3af182e 100644 (file)
--- 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
 
  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)
index 38bb4ef4cc5154dab2655c6a04b725e839f701dd..899ec3d5937f5a4fcb88b815e7b495ab1203dc89 100644 (file)
--- 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);
index 24b90d2ad044886d8052e30ab2865b258534888b..202da555a9211b97f34c72b3ec4e87c02b585599 100644 (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;
index 04e03ae9a574b1cc363645dd0727e3cccd87c7b6..2a282beb66923c2409e53636cad5f75674e4dacd 100644 (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. */