This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch 7.1.x in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push: new 0e29d18 Fixes a case on chunked cached objects, 304s and Ranges 0e29d18 is described below commit 0e29d1875a6691b9f6c42fa495cb963d66347dce Author: Leif Hedstrom <zw...@apache.org> AuthorDate: Fri Apr 6 13:06:36 2018 -0600 Fixes a case on chunked cached objects, 304s and Ranges Before this fix, in the deranged case of 1. Chunked object in cache (which is a static asset) 2. Object goes stale 3. Client does a Range request 4. Origin responds with a 304 we can serve a "200 OK" with a partial object (the requested range). This not only messes up a client, but in the parent proxy setup, can pollute the downstream cache with a truncated object. This fixes #3409. (cherry picked from commit be0a07c0224b0288fa7855bea3279650e395c6e9) --- proxy/http/HttpTransact.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index eaadead..bcd383b 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -6871,7 +6871,7 @@ HttpTransact::handle_content_length_header(State *s, HTTPHdr *header, HTTPHdr *b } DebugTxn("http_trans", "[handle_content_length_header] RESPONSE cont len in hdr is %" PRId64, header->get_content_length()); } else { - // No content length header + // No content length header. if (s->source == SOURCE_CACHE) { // If there is no content-length header, we can // insert one since the cache knows definately @@ -6893,6 +6893,12 @@ HttpTransact::handle_content_length_header(State *s, HTTPHdr *header, HTTPHdr *b header->set_content_length(cl); s->hdr_info.trust_response_cl = true; } + } else if (s->source == SOURCE_HTTP_ORIGIN_SERVER && s->hdr_info.server_response.status_get() == HTTP_STATUS_NOT_MODIFIED && + s->range_setup == RANGE_NOT_TRANSFORM_REQUESTED) { + // In this case, we had a cached object, possibly chunked encoded (so we don't have a CL: header), but the origin did a + // 304 Not Modified response. We can still turn this into a proper Range response from the cached object. + change_response_header_because_of_range_request(s, header); + s->hdr_info.trust_response_cl = true; } else { // Check to see if there is no content length // header because the response precludes a -- To stop receiving notification emails like this one, please contact zw...@apache.org.