Content-Range in PUT is incorrect
Bug #820161 reported by
Jason McCarty
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar WebDAV plugin |
Fix Released
|
Low
|
Vincent Ladeuil |
Bug Description
_put_bytes_ranged sends an incorrect Content-Range header, based on my reading of RFC 2616 and examples. For example, when asked to send the second byte of a file, the function would send
Content-Range: bytes 1-2/*
Content-Length: 1
when it should send
Content-Range: bytes 1-1/*
Content-Length: 1
I don't know if this actually affects any servers, but a server that carefully checked everything would probably choke. Apache doesn't seem to compare content-range to content-length for sanity, it just seeks to the first offset given.
The attached patch corrects the (non-?) issue. I don't really know python, so caveat emptor.
Related branches
To post a comment you must log in.
Sorry for the delay and thanks for the patch.
Since we never got bug reports for this issue, I suspect all servers cares more about Content-length.
I''ll ignore the len(bytes) == 0 special case as:
1) silently ignoring the request will mask bugs
2) appending nothing means the method shouldn't be called at all so I consider it being the caller responsibility.