1

I am trying to do something similar as the asker of this question.

Uploading big files over HTTP

I want to implement Ryan's suggested WebDav methodology, but am running into issues with the server backend. I am attempting Http PUT and command line curls on large files, hoping to interrupt an upload and resume later, but my partially uploaded files are always being deleted when the transfer is broken. Am I missing an Apache setting somewhere?

Here is the curl command I am testing with:

curl -v -u test:test -C - -T 2gb.test http://my.server.net/webdav/

I have tried testing for a 206 response, which is apparently a required response for any server supporting this functionality. Can someone please confirm? I am receiving 200 responses from the following curl call:

curl -v --header "range: bytes=0-999" -X HEAD -u test:test http://my.server.net/webdav/

Community
  • 1
  • 1
Julien
  • 212
  • 1
  • 18
  • 53

2 Answers2

1

Julian looks to be much more authoritative than I am when it comes to webDAV. But in my experience PUT does support Content-Range, as long as the server implementes it (which Apache mod_dav does.) The webDAV spec doesn't seem to indicate one way or the other (http://asg.andrew.cmu.edu/rfc/rfc2518.html#sec-8.7) and the HTTP 1.1 spec doesn't require, but does allow content-range in PUT requests: (http://asg.andrew.cmu.edu/rfc/rfc2068.html#sec-9.6). That said, HTTP PATCH may be the better way to handle it. I've never used PATCH with non-text data, though.

Looking at the mod_dav code, though, it looks like it automatically cleans up the file if the upload fails, so my suggestion in the post you linked to won't quite work.

A possible (albeit a bit hacky) work-around would be to upload the file one chunk at a time. Upon failure, start uploading again with the chunk following the last successful one.

ryan
  • 884
  • 1
  • 9
  • 14
-2

Content-Range doesn't work for PUT.

The right thing to do here is to define a media type for "append binary", and use that with HTTP PATCH.

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98