cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL supports resumable upload via HTTP ?

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 12 Nov 2003 08:35:58 +0100 (CET)

On Wed, 12 Nov 2003, Pravin Jade wrote:

> To support resumable upload , I used -C - switch. But it is transferring
> data from start and not from where it was stopped.

Correct. I had to browse through some code to remember how this remind myself
on how this works and why...

The harsch reality is that you cannot use "-C -" to continue a HTTP upload
with curl, and in fact it will only behave oddly when you attempt to do so.
The reason it doesn't work with -C -, is that curl would need to first do a
HEAD request to know the size of the existing file and then do the PUT with
the proper resume point given.

At this point, you need to do that manually. Do a 'curl -I [URL]', figure out
the size and then 'curl -C [size] -T [upload] [URL]' and I believe it shall
work for you.

> D:\curl>curl -b fileName=DDSup.doc -C - -T faster.zip http://localhost:8080/
> put/fdgf.dop -# -v
> * About to connect() to localhost:8080
> * Connected to siddharth1.clearcase.mentorix.com (127.0.0.1) port 8080
> > PUT /put/tryupload.dop HTTP/1.1
> Content-Range: bytes -1-/549319371

This shows that curl sends in a resume position of "-1" which causes the
library to send a truly weird Content-Range: header.

> Can anybody help me in this regard ? Please show me what cURL options
> (switches) should I use OR it is a server problem i.e.not problem of cURL?

So, you can do this with curl if only slightly less automated. I realize this
is confusing, since the exact same command line works fine if you're doing an
FTP upload...

I would of course appreciate patches from anyone who's up to make '-C -' work
for HTTP PUT operations, but I believe it will take more than just a few
changed lines to make it happen.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
 [[ Do not post private mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
Received on 2003-11-12