dav: PATCH method implemented incorrectly and documentation is inconsistent.
I’m currently implementing an integrated *DAV server, and decided to make it understand a SabreDAV PATCH request format. But docs have this to say on specifying byte ranges:
Just like the HTTP Range header, the specified bytes is a 1-based index. This means that ‘bytes=0-3’ is invalid, as there is no ‘0th byte’.
Here is my question though: According to RFC 2616 section 14.35.1 “Byte offsets start at zero”. Which is not what current SabreDAV source does (from lib/Sabre/DAV/PartialUpdate/Plugin.php):
$etag = $node->putRange($body, $start-1);
So am I missing something here?
About this issue
- Original URL
- State: closed
- Created 13 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Added proof for #439. — committed to sabre-io/dav by evert 13 years ago
- Fixed the implementation of PATCH so it makes sense again. #439. — committed to sabre-io/dav by evert 13 years ago
- More bugfixes for #439. — committed to sabre-io/dav by evert 13 years ago
- Making the tests pass for master as well. #439 — committed to sabre-io/dav by evert 13 years ago
I messed this up, and pretty badly. This never worked correctly, and I don’t know why the tests don’t point this out.
The plugin is in line with the documentation, but then for some reason FSExt does indeed reduce the offset by 1.
If an offset of ‘1’ would be specified, FSExt would turn this into -1, which is obviously wrong.
It’s pretty great that you’d want to follow that document, but as you can see there’s embarrassingly some problems with it, and it must not have been actively used by anyone so far.
Since that’s the case, I will change the spec to be 0-indexed, and fix all the builds to fall in line with that.