This is an automated email from the ASF dual-hosted git repository.

eze pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d6e63d  url_sig debug fix for when url is missing the signature query 
string
3d6e63d is described below

commit 3d6e63d764bb8741d4f6a30227f651f0e7c6118a
Author: Brian Olsen <brian_ols...@comcast.com>
AuthorDate: Tue Apr 2 13:25:48 2019 +0000

    url_sig debug fix for when url is missing the signature query string
---
 plugins/experimental/url_sig/README    |  2 +-
 plugins/experimental/url_sig/url_sig.c | 14 ++++++++------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/plugins/experimental/url_sig/README 
b/plugins/experimental/url_sig/README
index a8b4360..9dc4dee 100644
--- a/plugins/experimental/url_sig/README
+++ b/plugins/experimental/url_sig/README
@@ -133,7 +133,7 @@ Example
 
        Add the remap rule like
 
-               map http://test-remap.domain.com http://google.com 
@plugin=url_sig.so @pparam=sign_test.config
+               map http://test-remap.domain.com http://google.com 
@plugin=url_sig.so @pparam=sign_test.config @pparam=pristineurl
 
        Restart traffic server or traffic_ctl config reload  - verify there are 
no errors in diags.log
 
diff --git a/plugins/experimental/url_sig/url_sig.c 
b/plugins/experimental/url_sig/url_sig.c
index 762a7da..a21861e 100644
--- a/plugins/experimental/url_sig/url_sig.c
+++ b/plugins/experimental/url_sig/url_sig.c
@@ -23,9 +23,9 @@
     _a < _b ? _a : _b;      \
   })
 
-#include "tscore/ink_defs.h"
 #include "url_sig.h"
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -538,7 +538,7 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo 
*rri)
   char sig_string[2 * MAX_SIG_SIZE + 1];
 
   if (current_url_len >= MAX_REQ_LEN - 1) {
-    err_log(url, "URL string too long");
+    err_log(current_url, "Request Url string too long");
     goto deny;
   }
 
@@ -555,15 +555,12 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, 
TSRemapRequestInfo *rri)
       err_log(url, "Pristine URL string too long.");
       goto deny;
     }
-
   } else {
     url_len = current_url_len;
   }
 
   TSDebug(PLUGIN_NAME, "%s", url);
 
-  const char *query = strchr(url, '?');
-
   if (cfg->regex) {
     const int offset = 0, options = 0;
     int ovector[30];
@@ -580,12 +577,17 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, 
TSRemapRequestInfo *rri)
     }
   }
 
+  const char *query = strchr(url, '?');
+
   // check for path params.
   if (query == NULL || strstr(query, "E=") == NULL) {
-    if ((url = urlParse(url, cfg->sig_anchor, new_path, 8192, path_params, 
8192)) == NULL) {
+    char *const parsed = urlParse(url, cfg->sig_anchor, new_path, 8192, 
path_params, 8192);
+    if (NULL == parsed) {
       err_log(url, "Has no signing query string or signing path parameters.");
       goto deny;
     }
+
+    url             = parsed;
     has_path_params = true;
     query           = strstr(url, ";");
 

Reply via email to