davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.01k stars 250 forks source link

Improve Range support #298

Closed jeffr-spire closed 2 years ago

jeffr-spire commented 2 years ago

Fix the last-byte-pos value in Content-Range response Return 416 Range Not Satisfiable if the range is beyond the file size


The Content-range header being generated was invalid; the last-byte-pos was equal to the complete-length. Especially notable was that wget -c would fail on range requests.

https://github.com/davidmoreno/onion/issues/239 may be caused by this same issue.

From https://httpwg.org/specs/rfc7233.html#header.content-range:

A Content-Range field value is invalid if it contains a byte-range-resp that has a last-byte-pos value less than its first-byte-pos value, or a complete-length value less than or equal to its last-byte-pos value.