cURL / Mailing Lists / curl-library / Single Mail

curl-library

FTP CRLF counter fix for multiple ASCII/text downloads

From: David McCreedy <mccreedytpf_at_msn.com>
Date: Fri, 14 Jul 2006 16:44:35 +0000

I failed to clear the CRLF (carriage return, line feed) counter in my
conversion code. Here's the fix.

ASCII/text FTP downloads now use a CRLF counter to track how many CRLFs were
converted to LFs on platforms that do line end conversions.
The attached patch resets the counter so it is correct on subsequent
ASCII/text FTP transfers on an existing session.
If the counter isn't reset, libcurl may erroneously think that only part of
the file was transferred, returning a CURLE_PARTIAL_FILE error.

Here's what the patch looks like:

diff -ruN curl1/lib/url.c curl2/lib/url.c
--- curl1/lib/url.c 2006-07-14 12:09:03.473528000 -0400
+++ curl2/lib/url.c 2006-07-14 12:10:46.683528000 -0400
@@ -3930,6 +3930,9 @@

   conn->bytecount = 0;
   conn->headerbytecount = 0;
+#ifdef CURL_DO_LINEEND_CONV
+ data->state.crlf_conversions = 0; /* reset CRLF conversion counter */
+#endif /* CURL_DO_LINEEND_CONV */

   if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {
     bool connected = FALSE;

As always, let me know if you have any concerns.

-David McCreedy

Received on 2006-07-14