[Bug 212065] fetch -r fails on a complete file, even with -S 12345 (OS version independent)

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Thu Jan 19 16:39:40 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=212065

Conrad Meyer <cem at freebsd.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cem at freebsd.org

--- Comment #1 from Conrad Meyer <cem at freebsd.org> ---
libfetch does appear to recognize that 416 errors might just be empty ranges:

1806                 case HTTP_BAD_RANGE:
1807                         /*
1808                          * This can happen if we ask for 0 bytes because
1809                          * we already have the whole file.  Consider this
1810                          * a success for now, and check sizes later.
1811                          */
1812                         break;

And if the HTTP server returns a Content-Range header along with the 416, it
treats that as no error:

1926                 /* requested range not satisfiable */
1927                 if (conn->err == HTTP_BAD_RANGE) {
1928                         if (url->offset == size && url->length == 0) {
1929                                 /* asked for 0 bytes; fake it */
1930                                 offset = url->offset;
1931                                 clength = -1;
1932                                 conn->err = HTTP_OK;
1933                                 break;

Otherwise, it treats it as an error:

1934                         } else {
1935                                 http_seterr(conn->err);
1936                                 goto ouch;
1937                         }

https://tools.ietf.org/html/rfc2616#section-14.16
>   The Content-Range entity-header is sent with a partial entity-body to
>   specify where in the full entity-body the partial body should be
>   applied.

>   A server sending a response with status code 416 (Requested range not
>   satisfiable) SHOULD include a Content-Range field with a byte-range-
>   resp-spec of "*". The instance-length specifies the current length of
>   the selected resource. 

The byte-range-resp-spec is the left side of the A-B/C style response of
Content-Range.  So httpds should respond to zero byte range requests with 416 +
Content-Range: bytes */1234, if the total file size is 1234.

It appears that ec2's web server isn't following this SHOULD recommendation. 
That's allowed, it's not a MUST.  So maybe libfetch needs to be a little more
tolerant of such responses.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list