Github user bryancall commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/864#discussion_r74672814
--- Diff: proxy/http/HttpTransact.cc ---
@@ -4785,27 +4785,34 @@
HttpTransact::merge_and_update_headers_for_cache_update(State *s)
}
if (s->api_modifiable_cached_resp) {
- ink_assert(s->cache_info.object_store.response_get() != NULL &&
s->cache_info.object_store.response_get()->valid());
+ ink_assert(cached_hdr != NULL && cached_hdr->valid());
s->api_modifiable_cached_resp = false;
} else {
s->cache_info.object_store.response_set(s->cache_info.object_read->response_get());
}
-
merge_response_header_with_cached_header(s->cache_info.object_store.response_get(),
&s->hdr_info.server_response);
+ // Delete caching headers from the cached response. If these are still
being served
+ // by the origin we will copy new versions in from the server response.
+ cached_hdr->field_delete(MIME_FIELD_AGE, MIME_LEN_AGE);
+ cached_hdr->field_delete(MIME_FIELD_CACHE_CONTROL,
MIME_LEN_CACHE_CONTROL);
+ cached_hdr->field_delete(MIME_FIELD_ETAG, MIME_LEN_ETAG);
+ cached_hdr->field_delete(MIME_FIELD_EXPIRES, MIME_LEN_EXPIRES);
+ cached_hdr->field_delete(MIME_FIELD_LAST_MODIFIED,
MIME_LEN_LAST_MODIFIED);
--- End diff --
I don't think it is a good idea to delete Expires, Last-Modifed, or
Cache-Control from the cached object. They are not required to be sent from
the origin according to the HTTP/1.1 RFC on a 304:
https://tools.ietf.org/html/rfc2616#section-10.3.5
The newer RFC (https://tools.ietf.org/html/rfc7232#section-4.1) changed
this, but we should still support RFC2616.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---