[ 
https://issues.apache.org/jira/browse/TS-4751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15419213#comment-15419213
 ] 

James Peach commented on TS-4751:
---------------------------------

Proposed patch:
{code}
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 6a2d867..ea60ef0 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -4800,6 +4800,7 @@ 
HttpTransact::merge_and_update_headers_for_cache_update(State *s)
     // a 304 without a Date Header, use the current time
     // as the new Date value in the header to be cached.
     time_t date_value   = s->hdr_info.server_response.get_date();
+    time_t new_age = 0;
     HTTPHdr *cached_hdr = s->cache_info.object_store.response_get();
 
     if (date_value <= 0) {
@@ -4811,14 +4812,15 @@ 
HttpTransact::merge_and_update_headers_for_cache_update(State *s)
     // Just use 'now' - 304's Date: + Age: (response's Age: if there)
     date_value = max(s->current.now - date_value, (ink_time_t)0);
     if (s->hdr_info.server_response.presence(MIME_PRESENCE_AGE)) {
-      time_t new_age = s->hdr_info.server_response.get_age();
+      new_age = s->hdr_info.server_response.get_age();
+    }
 
       if (new_age >= 0) {
         cached_hdr->set_age(date_value + new_age);
       } else {
         cached_hdr->set_age(-1); // Overflow
       }
-    }
+
     delete_warning_value(cached_hdr, HTTP_WARNING_CODE_REVALIDATION_FAILED);
   }
 {code}

Looks like this behaviour was altered in 94e16647e3.

> revalidation can skip updating the Age header
> ---------------------------------------------
>
>                 Key: TS-4751
>                 URL: https://issues.apache.org/jira/browse/TS-4751
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Cache, Core
>            Reporter: James Peach
>
> In {{HttpTransact::merge_and_update_headers_for_cache_update}}, the cached 
> {{Age}} header is only updated if the server response also contains an 
> {{Age}} header. If the revalidation response does not contain an {{Age}}, we 
> will retain the cache {{Age}} header which makes the document permanently 
> stale, causing a revalidation on every request.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to