-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PATCH method implemented incorrectly and documentation is inconsistent. #439
Comments
In addition to original question, I now see that implementation of putRange method (at least in FSExt backend) also decrements offset by 1. Is that a bug, or maybe I don't understand something? Also, according to docs:
But code disagrees:
|
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. |
Bit of a WTF moment :( |
Thank you for your clarification. PS: If I read the code correctly, currently if range start is omitted, then final offset which is passed to |
Also, I realized just now, that if you follow the HTTP spec, you can't really omit range start, because |
I'll re-read the entire specification and make 100% sure I got it right this time. Note that I'll be using this doc: http://tools.ietf.org/html/draft-ietf-httpbis-p5-range-26 |
@unikmhz i revamped the patch document to match the HTTP Range header. This is how I intend to fix the implementation. Frankly it was a bit of a mess, and it sucks to have to do this in a small release. But I would love for you to review it and tell me that it matches your expectation. Just in case I messed it up: |
Seems to be good, I implemented mostly the same behaviour. Some notes:
|
Concerning append: alternative method is to maybe add another header, and require one or the other. |
Good ideas all around :) I will take a look at the validity of |
You know, the variant with a different header is more to my liking, because code/library which expects a range spec in a particular header will silently drop all non-conforming values. So separate header removes the need to access raw header data for users of "HTTP protocol parser libraries" and makes it more error-resistant. EDIT: also, in this case the spec must prohibit sending both headers in one request. |
Yea I like the idea as well :) |
Updated the spec with all the suggestions. I did end up with I'm now starting work to ensure that sabre/dav also shows this behavior. |
Thanks, I'm updating my code now. Another question: what are header/status requirements for a server reply. I'm currently sending 204 status and an updated etag. EDIT: grammar fail on my end - sorry - spec sentence that I quoted uses "than" instead of "then". |
I just updated the doc with the status codes I'm sending back. Had update ready minutes before your last comment ;) Let me know if that works for you. This bug is now fixed, so I'm closing it. |
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:
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
):So am I missing something here?
The text was updated successfully, but these errors were encountered: