Fix partial requests (used by fetch -r) when the requested file is
already complete. Since 416 is an error code, any Content-Range header in the response would refer to the error message, not the requested document, so relying on the value of size when we know we got a 416 is wrong. Instead, just verify that offset == 0 and assume that we've reached the end of the document (if offset > 0, we did not request a range, and the server is screwing with us). Note that we cannot distinguish between reaching the end and going past it, but that is a flaw in the protocol, not in the code, so we just have to assume that the caller knows what it's doing. A smart caller would request an offset slightly before what it believes is the end and compare the result to what is already in the file. PR: 212065 Reported by: mandree MFC after: 3 weeks
This commit is contained in:
parent
c1ad4beb32
commit
c8453e5bf4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314701
@ -1925,7 +1925,7 @@ http_request_body(struct url *URL, const char *op, struct url_stat *us,
|
||||
|
||||
/* requested range not satisfiable */
|
||||
if (conn->err == HTTP_BAD_RANGE) {
|
||||
if (url->offset == size && url->length == 0) {
|
||||
if (url->offset > 0 && url->length == 0) {
|
||||
/* asked for 0 bytes; fake it */
|
||||
offset = url->offset;
|
||||
clength = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user