You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ig...@apache.org on 2012/02/29 21:01:32 UTC

git commit: TS-824 Range requests that result in cache refresh give 200 status response with full contents. Review and suggestions for improvements by Charlie Gero. Backport of 47439ce74c66132752d73d4316408eedf2e79f5a / r1181280 Review/Test: briang, zwoo

Updated Branches:
  refs/heads/3.0.x fcf1f824e -> fbcb4b8bd


TS-824 Range requests that result in cache refresh give 200 status response with full contents.
Review and suggestions for improvements by Charlie Gero.
Backport of 47439ce74c66132752d73d4316408eedf2e79f5a / r1181280
Review/Test: briang, zwoop, zym
Backprt: igalic


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

Branch: refs/heads/3.0.x
Commit: fbcb4b8bdc808ec777b15f49627f8c48ad25523e
Parents: fcf1f82
Author: Leif Hedstrom <zw...@apache.org>
Authored: Mon Oct 10 22:31:15 2011 +0000
Committer: Igor Galić <ig...@apache.org>
Committed: Wed Feb 29 20:59:29 2012 +0100

----------------------------------------------------------------------
 CHANGES                    |    4 ++++
 STATUS                     |    5 -----
 proxy/http/HttpTransact.cc |   12 +++++++-----
 3 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbcb4b8b/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index f1f78a6..b70108a 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.0.4
+  *) [TS-824] Range requests that result in cache refresh give 200 status
+   response with full contents. Review and suggestions for improvements
+   by Charlie Gero.
+
   *) [TS-880] Major performance problem with second request on same keep-alive connection
    Author: 	weijin
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbcb4b8b/STATUS
----------------------------------------------------------------------
diff --git a/STATUS b/STATUS
index fb413d0..1fcf0b6 100644
--- a/STATUS
+++ b/STATUS
@@ -40,11 +40,6 @@ A list of all bugs open for the next v3.0.4 release can be found at
   http://s.apache.org/ts-3.0.4
 
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
-  
-  *) Range requests that result in cache refresh give 200 status response with full contents
-   Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1181280
-   Jira: https://issues.apache.org/jira/browse/TS-824
-   +1: briang, zwoop, zym
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbcb4b8b/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index dc86d2d..cda1564 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -2312,7 +2312,6 @@ HttpTransact::HandleCacheOpenReadHitFreshness(State* s)
 void
 HttpTransact::CallOSDNSLookup(State* s)
 {
-//printf("into HttpTransact::CallOSDNSLookup **\n");
   TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
 }
 
@@ -2726,10 +2725,8 @@ HttpTransact::build_response_from_cache(State* s, HTTPWarningCode warning_code)
       // only if the cached response is a 200 OK
       if (client_response_code == HTTP_STATUS_OK && client_request->presence(MIME_PRESENCE_RANGE)) {
         s->state_machine->do_range_setup_if_necessary();
-        if (s->range_setup == RANGE_NOT_SATISFIABLE &&
-            s->http_config_param->reverse_proxy_enabled) {
+        if (s->range_setup == RANGE_NOT_SATISFIABLE && s->http_config_param->reverse_proxy_enabled) {
           build_error_response(s, HTTP_STATUS_RANGE_NOT_SATISFIABLE, "Requested Range Not Satisfiable","","");
-
           s->cache_info.action = CACHE_DO_NO_ACTION;
           s->next_action = PROXY_INTERNAL_CACHE_NOOP;
           break;
@@ -4108,7 +4105,6 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
 
     } else if (s->cache_info.action == CACHE_DO_UPDATE && is_request_conditional(&s->hdr_info.server_request)) {
       // CACHE_DO_UPDATE and server response is cacheable
-
       if (is_request_conditional(&s->hdr_info.client_request)) {
         if (s->txn_conf->cache_when_to_revalidate != 4)
           client_response_code =
@@ -4136,6 +4132,12 @@ HttpTransact::handle_cache_operation_on_forward_server_response(State* s)
           s->cache_info.action = CACHE_DO_UPDATE;
           s->next_action = SERVER_READ;
         } else {
+          if (s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
+            s->state_machine->do_range_setup_if_necessary();
+            // Note that even if the Range request is not satisfiable, we
+            // update and serve this cache. This will give a 200 response to
+            // a bad client, but allows us to avoid pegging the origin (e.g. abuse).
+          }
           s->cache_info.action = CACHE_DO_SERVE_AND_UPDATE;
           s->next_action = SERVE_FROM_CACHE;
         }