You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/04/02 19:50:06 UTC

trafficserver git commit: TS-3483: Fix regex_map to work with CONNECT.

Repository: trafficserver
Updated Branches:
  refs/heads/master 26f438d48 -> e8965f41a


TS-3483: Fix regex_map to work with CONNECT.


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

Branch: refs/heads/master
Commit: e8965f41a9343178490d0791936a1d11713ad2c5
Parents: 26f438d
Author: Alan M. Carroll <am...@apache.org>
Authored: Thu Apr 2 11:53:33 2015 -0500
Committer: Alan M. Carroll <am...@apache.org>
Committed: Thu Apr 2 12:49:45 2015 -0500

----------------------------------------------------------------------
 CHANGES                        | 2 ++
 proxy/http/remap/UrlRewrite.cc | 7 +++++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e8965f41/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 4fc7b6e..7257057 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3483] Fix regex remap to work with CONNECT.
+
   *) [TS-3479] Remove verbose Warning() from HTTP/2 connections.
 
   *) [TS-3470] traffic_server --help segfaults when SPDY is enabled.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e8965f41/proxy/http/remap/UrlRewrite.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc
index f6accb8..64681c4 100644
--- a/proxy/http/remap/UrlRewrite.cc
+++ b/proxy/http/remap/UrlRewrite.cc
@@ -891,6 +891,13 @@ UrlRewrite::_regexMappingLookup(RegexMappingList &regex_mappings, URL *request_u
   int request_path_len, reg_map_path_len;
   const char *request_path = request_url->path_get(&request_path_len), *reg_map_path;
 
+  // If the scheme is empty (e.g. because of a CONNECT method), guess it based on port
+  // This is equivalent to the logic in UrlMappingPathIndex::_GetTrie().
+  if (request_scheme_len == 0) {
+    request_scheme = request_port == 80 ? URL_SCHEME_HTTP : URL_SCHEME_HTTPS;
+    request_scheme_len = hdrtoken_wks_to_length(request_scheme);
+  }
+
   // Loop over the entire linked list, or until we're satisfied
   forl_LL(RegexMapping, list_iter, regex_mappings)
   {