Repository: trafficserver
Updated Branches:
  refs/heads/master f2facb7f6 -> d632e7f5d


TS-2912: Don't clear stale object on HEAD request.


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

Branch: refs/heads/master
Commit: d632e7f5d50eb27cfaf4bee384fb8f999c890a5e
Parents: f2facb7
Author: weijin <[email protected]>
Authored: Wed Aug 20 07:32:23 2014 -0500
Committer: Alan M. Carroll <[email protected]>
Committed: Wed Aug 20 07:32:23 2014 -0500

----------------------------------------------------------------------
 CHANGES                    |  2 ++
 proxy/http/HttpTransact.cc | 10 +++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d632e7f5/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d8bc8b8..722a389 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.1.0
 
+  *) [TS-2912] Don't clear stale object on HEAD request.
+
   *) [TS-2905] Change IP logging to print '0' instead of error text.
 
   *) [TS-2982] Interim cache compile errors.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d632e7f5/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 39f0ed9..b41f4c1 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -151,7 +151,8 @@ is_request_conditional(HTTPHdr* header)
   uint64_t mask = (MIME_PRESENCE_IF_UNMODIFIED_SINCE |
                  MIME_PRESENCE_IF_MODIFIED_SINCE | MIME_PRESENCE_IF_RANGE |
                  MIME_PRESENCE_IF_MATCH | MIME_PRESENCE_IF_NONE_MATCH);
-  return (header->presence(mask) && (header->method_get_wksidx() == 
HTTP_WKSIDX_GET));
+  return (header->presence(mask) && (header->method_get_wksidx() == 
HTTP_WKSIDX_GET ||
+                         header->method_get_wksidx() == HTTP_WKSIDX_HEAD));
 }
 
 static inline bool
@@ -2321,7 +2322,8 @@ HttpTransact::issue_revalidate(State* s)
     //   (or is method that we don't conditionalize but lookup the
     //    cache on like DELETE)
     if (c_resp->get_last_modified() > 0 &&
-        s->hdr_info.server_request.method_get_wksidx() == HTTP_WKSIDX_GET && 
s->range_setup == RANGE_NONE) {
+        (s->hdr_info.server_request.method_get_wksidx() == HTTP_WKSIDX_GET ||
+               s->hdr_info.server_request.method_get_wksidx() == 
HTTP_WKSIDX_HEAD) && s->range_setup == RANGE_NONE) {
       // make this a conditional request
       int length;
       const char *str = c_resp->value_get(MIME_FIELD_LAST_MODIFIED, 
MIME_LEN_LAST_MODIFIED, &length);
@@ -2331,7 +2333,9 @@ HttpTransact::issue_revalidate(State* s)
         DUMP_HEADER("http_hdrs", &s->hdr_info.server_request, 
s->state_machine_id, "Proxy's Request (Conditionalized)");
     }
     // if Etag exists, also add if-non-match header
-    if (c_resp->presence(MIME_PRESENCE_ETAG) && 
s->hdr_info.server_request.method_get_wksidx() == HTTP_WKSIDX_GET) {
+    if (c_resp->presence(MIME_PRESENCE_ETAG) &&
+                       (s->hdr_info.server_request.method_get_wksidx() == 
HTTP_WKSIDX_GET ||
+                        s->hdr_info.server_request.method_get_wksidx() == 
HTTP_WKSIDX_HEAD)) {
       int length;
       const char *etag = c_resp->value_get(MIME_FIELD_ETAG, MIME_LEN_ETAG, 
&length);
       if ((length >= 2) && (etag[0] == 'W') && (etag[1] == '/')) {

Reply via email to