arturobernalg opened a new pull request, #1257: URL: https://github.com/apache/tomcat/pull/1257
DefaultServlet returns 416 for a multi-range request as soon as one range-spec is unsatisfiable. For a 100 byte resource, `Range: bytes=0-1,200-300` gets 416 although `0-1` can be served. RFC 9110, section 14.1.1: "A valid ranges-specifier is "satisfiable" if it contains at least one range-spec that is satisfiable". Section 14.2 then calls for a 206 with the satisfiable range-spec(s), section 15.5.17 limits 416 to the case where none of the ranges are satisfiable and section 15.3.7.2 excludes unsatisfiable ranges from a multipart response. Unsatisfiable range-specs are now skipped before validation. Invalid range-specs (last-pos less than first-pos) are still rejected and a request with no satisfiable range still gets 416. Tested on a local Tomcat: | Range (100 byte file) | before | after | |---|---|---| | `bytes=0-1,200-300` | 416 | 206, `bytes 0-1/100` | | `bytes=200-300,0-1` | 416 | 206, `bytes 0-1/100` | | `bytes=0-1,200-300,4-5` | 416 | 206, multipart `0-1` and `4-5` | | `bytes=200-300` | 416 | 416 | | `bytes=200-100,0-1` | 416 | 416 | Tests added to TestDefaultServletRangeRequests fail without the change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
