curl-users
Re: FTP uploading/resuming with curl
Date: Mon, 6 Aug 2001 08:09:33 +0200 (MET DST)
On Fri, 3 Aug 2001, Isabel Cisternas & Robert Schmidt wrote:
> 1. Is there a way to tell curl to resume an FTP upload if the remote file
> exists, but start the upload from the beginning if it doesn't?
> Currently, curl fails with error 32 (could't get file size).
No, it isn't currently possible without reinvoking curl without the 'resume'
option set.
The logic behinds this is that you asked for a resumed upload and it can't
resume anything that doesn't exist.
Is there a good reason why we should change this?
> 2. When resuming a large FTP upload, curl seems to read or scan the
> entire source file, up to the the point where resuming starts. Is there
> any good reason for this? It takes a long time, and hogs system
> resources for basically no purpose, as I see it.
There is a reason, if it is good or not I leave for others to judge:
curl, the tool, uses libcurl for doing the uploads. Curl passes a FILE * to
libcurl to upload from, which can be a file, a pipe, stdin or whatever.
libcurl thus can't "seek" through that file as it only has a stream to read
from, and thus to get to the point where it should start the upload it reads
and throws away data.
To change this, we'd need to add a new option to libcurl to pass a true file
or we could do the seeking in curl and somehow tell libcurl that we've
already seeked to the proper place.
-- Daniel Stenberg -- curl dude -- http://curl.haxx.se/Received on 2001-08-06