cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-3048174 ] CURLOPT_RESUME_FROM does APPE instead of REST

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Sat, 21 Aug 2010 19:50:15 +0000

Bugs item #3048174, was opened at 2010-08-19 00:34
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3048174&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: ftp
Group: bad behaviour
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: catalin (catalinr)
Assigned to: Daniel Stenberg (bagder)
Summary: CURLOPT_RESUME_FROM does APPE instead of REST

Initial Comment:
This happens (at least) when using FTP, upload, using c/c++ libcurl.
I don't have a way to reproduce this at hand, but if my eyes did not deceive me there were three APPE commands sent when using the mentioned curl option. (One is already the wrong way to go as REST is needed here, but why 3 of them?) They were intercepted by "SoftPerfect Network Protocol Analyzer".

I believe this was already mentioned here: http://curl.haxx.se/mail/lib-2008-08/0426.html , but I can't find it in the change.log, nor "known bugs", nor anywhere...

The workaround was to setup a regular upload and use something like
    curl_easy_setopt(curl, CURLOPT_PREQUOTE, opsBeforeUpload);
where curl_slist contained one option like "REST 12345" // 12345 was the file location where the resume should start from.
And BTW, I could not find anywhere in the docs what is expected for CURLOPT_INFILESIZE in case of CURLOPT_RESUME_FROM and CURLOPT_APPEND. If my "experiments" were correct, the argument for the former option is the remaining size to be uploaded, and not the whole file size as "[...]FILESIZE" seems to imply... But finding it out that way was quite frustrating...

IMHO the sources are in a great need of comments, especially for the internal functions. I did attempt to try to find and fix this but was quickly defeated by the impossibility of finding a starting point.

libcurl 7.21.1
msw Vista
mingw-gcc 3.4.5

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2010-08-21 21:50

Message:
quite clearly (from reading the source code and thinking about this), you
should rather use CURLOPT_APPEND and not resume at all when you upload with
FTP to append to the existing file. libcurl never does REST for anything
but downloads.

RESUME_FROM in this case will cause libcurl to try to seek in the _source_
file to resume a particular position in the upload. This is verified by
test case 123 for example.

So, I'm not at all sure that we can fix this problem by changing the
resume code to do REST as that will most likely change existing
behaviors...

----------------------------------------------------------------------

Comment By: catalin (catalinr)
Date: 2010-08-21 06:30

Message:
Just try to use CURLOPT_RESUME_FROM[_LARGE] option and check the actual FTP
command being sent...

See the attached sample too; just make sure the file is already at
destination and has at least 'offset' size (see 'offset' variable in the
source).

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2010-08-19 15:18

Message:
Please don't squeeze in lots of subjects in a single bug report, remain
focused. If you have discussion points, take them to the curl-library
mailing list.

Can you please help us get a recipe to repeat this problem more exactly?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3048174&group_id=976
Received on 2010-08-21

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET