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

trafficserver git commit: TS-3515: Couple things to clean up...

Repository: trafficserver
Updated Branches:
  refs/heads/master c800ef075 -> fbdb945bb


TS-3515: Couple things to clean up...


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

Branch: refs/heads/master
Commit: fbdb945bba7409c96a10541773b0272e6bbd3065
Parents: c800ef0
Author: Bryan Call <bc...@apache.org>
Authored: Thu Apr 9 17:18:54 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Thu Apr 9 17:18:54 2015 -0700

----------------------------------------------------------------------
 lib/ts/Regex.cc                 | 2 +-
 lib/ts/Regex.h                  | 2 +-
 proxy/http/remap/RemapConfig.cc | 9 +++++++--
 proxy/http/remap/UrlRewrite.cc  | 3 +--
 4 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbdb945b/lib/ts/Regex.cc
----------------------------------------------------------------------
diff --git a/lib/ts/Regex.cc b/lib/ts/Regex.cc
index 29488c5..f267d24 100644
--- a/lib/ts/Regex.cc
+++ b/lib/ts/Regex.cc
@@ -48,7 +48,7 @@ get_jit_stack(void *data ATS_UNUSED)
 #endif
 
 bool
-Regex::compile(const char *pattern, const unsigned flags, const int max_captures)
+Regex::compile(const char *pattern, const unsigned flags)
 {
   const char *error;
   int erroffset;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbdb945b/lib/ts/Regex.h
----------------------------------------------------------------------
diff --git a/lib/ts/Regex.h b/lib/ts/Regex.h
index 7d413b9..e16a01e 100644
--- a/lib/ts/Regex.h
+++ b/lib/ts/Regex.h
@@ -42,7 +42,7 @@ class Regex
 {
 public:
   Regex() : regex(NULL), regex_extra(NULL) {}
-  bool compile(const char *pattern, const unsigned flags = 0, const int max_captures = 10);
+  bool compile(const char *pattern, const unsigned flags = 0);
   // It is safe to call exec() concurrently on the same object instance
   bool exec(const char *str);
   bool exec(const char *str, int length);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbdb945b/proxy/http/remap/RemapConfig.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/RemapConfig.cc b/proxy/http/remap/RemapConfig.cc
index 14d8229..3f5db31 100644
--- a/proxy/http/remap/RemapConfig.cc
+++ b/proxy/http/remap/RemapConfig.cc
@@ -800,10 +800,15 @@ process_regex_mapping_config(const char *from_host_lower, url_mapping *new_mappi
   }
 
   captures = reg_map->regular_expression.get_capture_count();
+  if (captures == -1) {
+    Warning("pcre_fullinfo failed!");
+    goto lFail;
+  }
   if (captures >= UrlRewrite::MAX_REGEX_SUBS) { // off by one for $0 (implicit capture)
-    Error("regex has %d capturing subpatterns (including entire regex); Max allowed: %d", captures + 1, UrlRewrite::MAX_REGEX_SUBS);
-    return -1;
+    Warning("regex has %d capturing subpatterns (including entire regex); Max allowed: %d", captures + 1, UrlRewrite::MAX_REGEX_SUBS);
+    goto lFail;
   }
+
   to_host = new_mapping->toUrl.host_get(&to_host_len);
   for (int i = 0; i < (to_host_len - 1); ++i) {
     if (to_host[i] == '$') {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fbdb945b/proxy/http/remap/UrlRewrite.cc
----------------------------------------------------------------------
diff --git a/proxy/http/remap/UrlRewrite.cc b/proxy/http/remap/UrlRewrite.cc
index 3069e3d..f4c890b 100644
--- a/proxy/http/remap/UrlRewrite.cc
+++ b/proxy/http/remap/UrlRewrite.cc
@@ -929,8 +929,7 @@ UrlRewrite::_regexMappingLookup(RegexMappingList &regex_mappings, URL *request_u
 
     int matches_info[MAX_REGEX_SUBS * 3];
     int match_result = list_iter->regular_expression.exec(request_host, request_host_len, matches_info, countof(matches_info));
-    //    int match_result = pcre_exec(list_iter->re, list_iter->re_extra, request_host, request_host_len, 0, 0, matches_info,
-    //                                 (sizeof(matches_info) / sizeof(int)));
+
     if (match_result > 0) {
       Debug("url_rewrite_regex", "Request URL host [%.*s] matched regex in mapping of rank %d "
                                  "with %d possible substitutions",