trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1181280 - in /trafficserver/traffic/trunk: CHANGES proxy/http/HttpTransact.cc
Date Mon, 10 Oct 2011 22:31:16 GMT
Author: zwoop
Date: Mon Oct 10 22:31:15 2011
New Revision: 1181280

URL: http://svn.apache.org/viewvc?rev=1181280&view=rev
Log:
TS-824 Range requests that result in cache refresh give 200 status response with full contents.

Review and suggestions for improvements by Charlie Gero.

Modified:
    trafficserver/traffic/trunk/CHANGES
    trafficserver/traffic/trunk/proxy/http/HttpTransact.cc

Modified: trafficserver/traffic/trunk/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/CHANGES?rev=1181280&r1=1181279&r2=1181280&view=diff
==============================================================================
--- trafficserver/traffic/trunk/CHANGES (original)
+++ trafficserver/traffic/trunk/CHANGES Mon Oct 10 22:31:15 2011
@@ -1,5 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.1.1
+  *) [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-964] Add 64-bit integer plugin APIs for HTTP headers.
 
   *) [TS-932] Fix m_pending_event == NULL crash in LogCollationClientSM.cc

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.cc?rev=1181280&r1=1181279&r2=1181280&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.cc Mon Oct 10 22:31:15 2011
@@ -2303,7 +2303,6 @@ HttpTransact::HandleCacheOpenReadHitFres
 void
 HttpTransact::CallOSDNSLookup(State* s)
 {
-//printf("into HttpTransact::CallOSDNSLookup **\n");
   TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
 }
 
@@ -2717,10 +2716,8 @@ HttpTransact::build_response_from_cache(
       // 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_
 
     } 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_
           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;
         }



Mime
View raw message