If a partial file has been read or written, force a closure the existing
authorDaniel Stenberg <daniel@haxx.se>
Wed, 19 Nov 2003 14:36:42 +0000 (14:36 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 19 Nov 2003 14:36:42 +0000 (14:36 +0000)
connection to avoid re-use of it, since we cannot know in what state it is.

lib/ftp.c

index 5db4c5fc37d849a9461c2a95d605e94d5385edce..c464f746ca8f6df789640ad3cc371b207bdf8a09 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -637,6 +637,8 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
        !data->set.crlf) {
       failf(data, "Uploaded unaligned file size (%d out of %d bytes)",
             *ftp->bytecountp, data->set.infilesize);
+      conn->bits.close = TRUE; /* close this connection since we don't
+                                  know what state this error leaves us in */
       return CURLE_PARTIAL_FILE;
     }
   }
@@ -644,6 +646,8 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
     if((-1 != conn->size) && (conn->size != *ftp->bytecountp) &&
        (conn->maxdownload != *ftp->bytecountp)) {
       failf(data, "Received only partial file: %d bytes", *ftp->bytecountp);
+      conn->bits.close = TRUE; /* close this connection since we don't
+                                  know what state this error leaves us in */
       return CURLE_PARTIAL_FILE;
     }
     else if(!ftp->dont_check &&