You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sj...@apache.org on 2010/02/22 15:31:51 UTC

svn commit: r912582 - in /incubator/trafficserver/traffic/trunk/proxy: config/records.config.in http2/HttpTransact.cc

Author: sjiang
Date: Mon Feb 22 14:31:51 2010
New Revision: 912582

URL: http://svn.apache.org/viewvc?rev=912582&view=rev
Log:
TS-188: proxy.config.http.cache.required_headers value 1 does not allow caching of items with only Cache-Control: 
max-age

Changed to allow explicit lifetime on required_headers option 1 and require explicit lifetime on required_headers 
option 2

        Author: Steve Jiang
        Review: Leif Hedstrom


Modified:
    incubator/trafficserver/traffic/trunk/proxy/config/records.config.in
    incubator/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc

Modified: incubator/trafficserver/traffic/trunk/proxy/config/records.config.in
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/proxy/config/records.config.in?rev=912582&r1=912581&r2=912582&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/proxy/config/records.config.in (original)
+++ incubator/trafficserver/traffic/trunk/proxy/config/records.config.in Mon Feb 22 14:31:51 2010
@@ -255,8 +255,8 @@
 CONFIG proxy.config.http.cache.when_to_add_no_cache_to_msie_requests INT 0
    # required headers: three options:
    #   0 - No required headers to make document cachable
-   #   1 - at least, "Last-Modified:" header required
-   #   2 - explicit lifetime required, "Expires:" or "Cache-Control:"
+   #   1 - "Last-Modified:", "Expires:", or "Cache-Control: max-age" required
+   #   2 - explicit lifetime required, "Expires:" or "Cache-Control: max-age"
 CONFIG proxy.config.http.cache.required_headers INT 1
 CONFIG proxy.config.http.cache.max_stale_age INT 604800
 CONFIG proxy.config.http.cache.range.lookup INT 1

Modified: incubator/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc?rev=912582&r1=912581&r2=912582&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc (original)
+++ incubator/trafficserver/traffic/trunk/proxy/http2/HttpTransact.cc Mon Feb 22 14:31:51 2010
@@ -7150,7 +7150,7 @@
     // If a ttl is set: no header required for caching
     // otherwise: follow parameter http.cache.required_headers
     if (s->cache_control.ttl_in_cache <= 0) {
-
+      inku32 cc_mask = (MIME_COOKED_MASK_CC_MAX_AGE | MIME_COOKED_MASK_CC_S_MAXAGE);
       // server did not send expires header or last modified
       // and we are configured to not cache without them.
       switch (s->http_config_param->cache_required_headers) {
@@ -7159,8 +7159,9 @@
         break;
 
       case HttpConfigParams::CACHE_REQUIRED_HEADERS_AT_LEAST_LAST_MODIFIED:
-        if (!response->presence(MIME_PRESENCE_EXPIRES) && !response->get_last_modified()) {
-          Debug("http_trans", "[is_response_cacheable] " "last_modified required");
+        if (!response->presence(MIME_PRESENCE_EXPIRES) && !(response->get_cooked_cc_mask() & cc_mask) && 
+            !response->get_last_modified()) {
+          Debug("http_trans", "[is_response_cacheable] " "last_modified, expires, or max-age is required");
 
           // Set the WUTS code to NO_DLE or NO_LE only for 200 responses.
           if (response_code == HTTP_STATUS_OK) {
@@ -7172,8 +7173,8 @@
         break;
 
       case HttpConfigParams::CACHE_REQUIRED_HEADERS_CACHE_CONTROL:
-        if (!response->presence(MIME_PRESENCE_EXPIRES | MIME_PRESENCE_CACHE_CONTROL)) {
-          Debug("http_trans", "[is_response_cacheable] " "cache-control or expires header is required");
+        if (!response->presence(MIME_PRESENCE_EXPIRES) && !(response->get_cooked_cc_mask() & cc_mask)) {
+          Debug("http_trans", "[is_response_cacheable] " "expires header or max-age is required");
           return (false);
         }
         break;