[ https://issues.apache.org/jira/browse/TS-3331?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14295407#comment-14295407 ]
Bryan Call edited comment on TS-3331 at 1/28/15 6:03 PM: --------------------------------------------------------- {code} diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index ee04888..c1fea19 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -177,6 +177,8 @@ find_appropriate_cached_resp(HttpTransact::State* s) return s->cache_info.object_read->response_get(); } +int response_cacheable_indicated_by_cc(HTTPHdr* response); + inline static bool is_negative_caching_appropriate(HttpTransact::State* s) { @@ -196,7 +198,10 @@ is_negative_caching_appropriate(HttpTransact::State* s) case HTTP_STATUS_BAD_GATEWAY: case HTTP_STATUS_SERVICE_UNAVAILABLE: case HTTP_STATUS_GATEWAY_TIMEOUT: - return true; + return ((response_cacheable_indicated_by_cc(&s->hdr_info.server_response) > + (HttpTransactHeaders::does_server_allow_response_to_be_stored(&s->h + s->cache_control.ignore_server_no_cache || + (s->cache_control.ttl_in_cache > 0))); default: break; } {code} was (Author: wbardwel): diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc index ee04888..c1fea19 100644 --- a/proxy/http/HttpTransact.cc +++ b/proxy/http/HttpTransact.cc @@ -177,6 +177,8 @@ find_appropriate_cached_resp(HttpTransact::State* s) return s->cache_info.object_read->response_get(); } +int response_cacheable_indicated_by_cc(HTTPHdr* response); + inline static bool is_negative_caching_appropriate(HttpTransact::State* s) { @@ -196,7 +198,10 @@ is_negative_caching_appropriate(HttpTransact::State* s) case HTTP_STATUS_BAD_GATEWAY: case HTTP_STATUS_SERVICE_UNAVAILABLE: case HTTP_STATUS_GATEWAY_TIMEOUT: - return true; + return ((response_cacheable_indicated_by_cc(&s->hdr_info.server_response) > + (HttpTransactHeaders::does_server_allow_response_to_be_stored(&s->h + s->cache_control.ignore_server_no_cache || + (s->cache_control.ttl_in_cache > 0))); default: break; } > negative responses cached even when headers indicate otherwise > -------------------------------------------------------------- > > Key: TS-3331 > URL: https://issues.apache.org/jira/browse/TS-3331 > Project: Traffic Server > Issue Type: Bug > Components: Core > Reporter: William Bardwell > Assignee: William Bardwell > Fix For: 5.3.0 > > > Negative type status codes get cached even when there are Cache-Control: > no-store or the like headers and positive caching would be paying attention > to that. So the fix is to apply response headers (and general caching > config) to negative caching choices too. > My patch might fix [TS-2633] 406 negative responses being cached for too long -- This message was sent by Atlassian JIRA (v6.3.4#6332)