cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Issue with partial file transfer

From: Grzegorz Sikorski <engineer.gregor_at_gmail.com>
Date: Thu, 19 Apr 2012 13:35:26 +0200

Hi,

I have made some patch in lib/ftp.c file in function ftp_state_ul_setup.
Here is a diff:

/////////////////////////// DIFF ///////////////////////////
--- new_ftp.c 2012-04-19 13:07:43.893863376 +0200
+++ org_ftp.c 2012-01-23 16:31:30.000000000 +0100
@@ -1614,7 +1614,7 @@
     /* 4. lower the infilesize counter */
     /* => transfer as usual */

- if(data->state.resume_from < 0) {
+ if(data->state.resume_from < 0 ) {
       /* Got no given size to start from, figure it out */
       PPSENDF(&ftpc->pp, "SIZE %s", ftpc->file);
       state(conn, FTP_STOR_SIZE);
@@ -1677,24 +1677,7 @@
     }
     /* we've passed, proceed as normal */
   } /* resume_from */
- else if(data->state.resume_from < 0 && sizechecked) {
- /* server responded there is no file,
- but we know we are about to continue upload,
- seek back the file to the beginning
- and "append" entire file on server. */
- data->state.resume_from = 0;

- /* Make sure we are on the beginning of the file. */
- if(conn->seek_func) {
- seekerr = conn->seek_func(conn->seek_client, 0,
- SEEK_SET);
- }
-
- if(seekerr != CURL_SEEKFUNC_OK) {
- failf(data, "Could not seek stream");
- return CURLE_FTP_COULDNT_USE_REST;
- }
- }
   PPSENDF(&ftpc->pp, data->set.ftp_append?"APPE %s":"STOR %s",
           ftpc->file);
/////////////////////////// DIFF ///////////////////////////

Let me know if you think that is OK. I tested it and it works also in 4
case described in previous message.

Greg

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-19