cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: specify range with http PUT

From: John Meissen <john_at_meissen.org>
Date: Mon, 19 Feb 2007 13:26:39 -0800

daniel_at_haxx.se said:
> On Fri, 16 Feb 2007, John Meissen wrote:
> > I'd like to use curl to update small portions of large files on a web sever,
> > but it doesn't look like I can make it work.
>
> > Specifying the -r/--range option sounds like the logical approach, and it
> > creates the correct header. But it then starts at the beginning and attempts
> > to transfer the entire file.

> Hm, I remember we worked on this feature ages ago but I don't recall exactly
> where we ended up on this.

> The --range option only changes the range the request asks the server to
> deliver in its response (the Range: header). The header that limits what parts
> you send in a PUT would be Content-Range: (AFAIU), and you should be able to
> set that manually if the receive just understands it.

> I don't think we have any option that allows you to do this conveniently.

Actually, when doing a PUT with -r it correctly generates a Content-Range:
header with the values specified. The only thing it doesn't do right is
actually limit the data sent to that range. It creates a Content-Length:
header with the size of the file and starts sending from the beginning.

I can specify the starting location with -C, but I can't limit the size
to just a small portion. It always sends from that point to the end of file.
And mixing -r and -C just mangles the Content-Range: header.

I can manually create the Content-Length: header. The problem that I can't
get around is telling curl to only send a segment of the file.
Received on 2007-02-19