Updated Branches:
  refs/heads/master 6b0fe6708 -> 4c5fbfa06

TS-2269 regex_remap plugin does not deal with empty path's properly.

This is a problem when the request URL path is just '/', which inside
of ATS is an emptry string.

Review: leif


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

Branch: refs/heads/master
Commit: 98d06d2df771798954801ea53ee3148ff0f1f631
Parents: 6b0fe67
Author: Kit Chan <chanshukit at gmail dot com>
Authored: Sat Oct 12 09:15:13 2013 -0600
Committer: Leif Hedstrom <[email protected]>
Committed: Sat Oct 12 09:15:13 2013 -0600

----------------------------------------------------------------------
 plugins/regex_remap/regex_remap.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/98d06d2d/plugins/regex_remap/regex_remap.cc
----------------------------------------------------------------------
diff --git a/plugins/regex_remap/regex_remap.cc 
b/plugins/regex_remap/regex_remap.cc
index 63778d7..496fd30 100644
--- a/plugins/regex_remap/regex_remap.cc
+++ b/plugins/regex_remap/regex_remap.cc
@@ -800,9 +800,10 @@ TSRemapDoRemap(void* ih, TSHttpTxn txnp, 
TSRemapRequestInfo *rri)
   }
 
   *(match_buf + match_len) = '/';
+  match_len++;
   if (req_url.path && req_url.path_len > 0) {
-    memcpy(match_buf + match_len + 1, req_url.path, req_url.path_len);
-    match_len += (req_url.path_len + 1);
+    memcpy(match_buf + match_len, req_url.path, req_url.path_len);
+    match_len += (req_url.path_len);
   }
 
   if (ri->matrix_params && req_url.matrix && req_url.matrix_len > 0) {

Reply via email to