trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wbard...@apache.org
Subject trafficserver git commit: TS-3331: negative responses cached even when headers indicate otherwise
Date Wed, 11 Mar 2015 02:24:49 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 613f8dadd -> bd62e7006


TS-3331: negative responses cached even when headers indicate otherwise

Apply full caching rules to negative cached responses.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/bd62e700
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/bd62e700
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/bd62e700

Branch: refs/heads/master
Commit: bd62e7006547e9fc174a764b2c219f774643a31a
Parents: 613f8da
Author: William Bardwell <wbardwel@apache.org>
Authored: Tue Mar 10 22:00:11 2015 -0400
Committer: William Bardwell <wbardwel@apache.org>
Committed: Tue Mar 10 22:00:11 2015 -0400

----------------------------------------------------------------------
 CHANGES                    | 2 ++
 proxy/http/HttpTransact.cc | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bd62e700/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 79b0fa5..bd6bc61 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3331] negative responses cached even when headers indicate otherwise
+
   *) [TS-3417] Add MADV_DONTDUMP capability
 
   *) [TS-3036] Add a new log tag, 'chm', which shows cache-hit-miss specific

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bd62e700/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 1d5ae5f..3f512a4 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) >=
0) &&
+            (HttpTransactHeaders::does_server_allow_response_to_be_stored(&s->hdr_info.server_response)
||
+                s->cache_control.ignore_server_no_cache ||
+                (s->cache_control.ttl_in_cache > 0)));
   default:
     break;
   }


Mime
View raw message