You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by wb...@apache.org on 2015/03/11 04:13:43 UTC

trafficserver git commit: TS-3342 Non-standard method in bad request can cause crash

Repository: trafficserver
Updated Branches:
  refs/heads/master bd62e7006 -> 66bdd406f


TS-3342 Non-standard method in bad request can cause crash


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

Branch: refs/heads/master
Commit: 66bdd406f92e61bd0fdc86afe308a7563093896f
Parents: bd62e70
Author: William Bardwell <wb...@apache.org>
Authored: Tue Mar 10 23:12:49 2015 -0400
Committer: William Bardwell <wb...@apache.org>
Committed: Tue Mar 10 23:12:49 2015 -0400

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


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/66bdd406/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bd6bc61..ff61651 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3342] Non-standard method in bad request can cause crash
+
   *) [TS-3331] negative responses cached even when headers indicate otherwise
 
   *) [TS-3417] Add MADV_DONTDUMP capability

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/66bdd406/proxy/http/HttpTransact.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index 3f512a4..2f585e7 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -388,6 +388,13 @@ does_method_require_cache_copy_deletion(const HttpConfigParams *http_config_para
            (http_config_param->cache_post_method != 1 && method == HTTP_WKSIDX_POST)));
 }
 
+inline static bool
+does_method_effect_cache(int method)
+{
+  return ((method == HTTP_WKSIDX_GET  || method == HTTP_WKSIDX_DELETE ||
+           method == HTTP_WKSIDX_PURGE || method == HTTP_WKSIDX_PUT ||
+           method == HTTP_WKSIDX_POST));
+}
 
 inline static
 HttpTransact::StateMachineAction_t
@@ -2997,6 +3004,7 @@ HttpTransact::HandleCacheOpenReadMiss(State* s)
   if (does_method_require_cache_copy_deletion(s->http_config_param, s->method) && s->api_req_cacheable == false) {
     s->cache_info.action = CACHE_DO_NO_ACTION;
   } else if ((s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE) && !s->txn_conf->cache_range_write) ||
+             does_method_effect_cache(s->method) == false ||
              s->range_setup == RANGE_NOT_SATISFIABLE || s->range_setup == RANGE_NOT_HANDLED) {
     s->cache_info.action = CACHE_DO_NO_ACTION;
   } else {