midchildan opened a new pull request #8741: URL: https://github.com/apache/trafficserver/pull/8741
# Problem ATS doesn't respond correctly to conditional range requests. According to [the spec][1], ATS must ignore the `Range` header and send back the full content when the condition in the `If-Range` header isn't satisified. ATS responds with `416 Requested Range Not Satisfiable` instead. # How to reproduce 1. Prepare a cacheable HTTP endpoint for ATS (e.g., http://localhost/) 2. Launch ATS 3. Send a normal request for the entire content so that it'd be cached in ATS (e.g., `curl -vv http://localhost`) 4. Send a conditional range request for the cached content. Specify a weak etag so that it'd fail to meet the requirements needed to receive a partial response. (e.g., `curl -vv -H 'If-Range: W/"this_wont_match"' http://localhost`) # Cause ATS validates `If-Range` headers in `match_response_to_request_conditionals()`. If the condition specified in `If-Range` isn't met, `match_response_to_request_conditionals()` returns a response code of `HTTP_STATUS_RANGE_NOT_SATISFIABLE`. However, ATS can't determine whether a `HTTP_STATUS_RANGE_NOT_SATISFIABLE` response code came from `match_response_to_request_conditionals()` or the response of the original content. This confusion led ATS to return incorrect responses to conditional range requests. # Changes made - Move the `If-Range` header validation code out of `match_response_to_request_conditionals()` so that it would run right before processing the `Range` header. This makes it easier to determine the correct response. - Add autest test cases to check how ATS responds to range requests. [1]: https://datatracker.ietf.org/doc/html/rfc7233#section-3.2 -- 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]
