[ 
https://issues.apache.org/jira/browse/TS-4993?focusedWorklogId=30994&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-30994
 ]

ASF GitHub Bot logged work on TS-4993:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Oct/16 20:01
            Start Date: 24/Oct/16 20:01
    Worklog Time Spent: 10m 
      Work Description: Github user zwoop commented on a diff in the pull 
request:

    https://github.com/apache/trafficserver/pull/1133#discussion_r84729282
  
    --- Diff: plugins/header_rewrite/header_rewrite_test.cc ---
    @@ -31,274 +33,395 @@ const char PLUGIN_NAME_DBG[] = 
"TEST_dbg_header_rewrite";
     extern "C" void
     TSError(const char *fmt, ...)
     {
    -  char buf[2048];
    -  int bytes = 0;
    -  va_list args;
    -  va_start(args, fmt);
    -  if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
    -    fprintf(stderr, "TSError: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
    -  }
    -  va_end(args);
     }
     
    -extern "C" void
    -TSDebug(const char *tag, const char *fmt, ...)
    -{
    -  char buf[2048];
    -  int bytes = 0;
    -  va_list args;
    -  va_start(args, fmt);
    -  if ((bytes = vsnprintf(buf, sizeof(buf), fmt, args)) > 0) {
    -    fprintf(stdout, "TSDebug: %s: %.*s\n", PLUGIN_NAME, bytes, buf);
    -  }
    -  va_end(args);
    -}
    -
    -#define CHECK_EQ(x, y)                   \
    -  do {                                   \
    -    if ((x) != (y)) {                    \
    -      fprintf(stderr, "CHECK FAILED\n"); \
    -      return 1;                          \
    -    }                                    \
    -  } while (false);
    -
     class ParserTest : public Parser
     {
     public:
    -  ParserTest(std::string line) : Parser(line) {}
    +  ParserTest(std::string line) : Parser(line), res(true) { std::cout << 
"Starting parser test: " << line << std::endl; }
       std::vector<std::string>
       getTokens()
       {
         return _tokens;
       }
    +
    +  template <typename T, typename U>
    +  void
    +  do_parser_check(T x, U y, int line = 0)
    +  {
    +    if (x != y) {
    +      std::cerr << "CHECK FAILED on line " << line << ": " << x << " != " 
<< y << std::endl;
    +      res = false;
    +    }
    +  }
    +
    +  bool res;
    --- End diff --
    
    That's the check :). This is what DO_CHECK() used to do as a macro, but I 
turned it into a templetized function so that DO_CHECK can produce output about 
the check for the various types of input parameters.


Issue Time Tracking
-------------------

    Worklog Id:     (was: 30994)
    Time Spent: 1h 10m  (was: 1h)

> backslash/escape removed from header_rewrite rule when unquoted
> ---------------------------------------------------------------
>
>                 Key: TS-4993
>                 URL: https://issues.apache.org/jira/browse/TS-4993
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Plugins
>    Affects Versions: 7.0.0
>            Reporter: Randall Meyer
>            Assignee: Leif Hedstrom
>             Fix For: 7.1.0
>
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Loading up a configuration with a header_rewrite rule of:
> {noformat}
> cond %{READ_RESPONSE_HDR_HOOK} [AND]
> cond %{PATH} /(\.html|\.js|\.png)(?:\?(.*))*$/ [AND]
> cond %{STATUS} >199 [AND]
> cond %{STATUS} <300
>   set-header Cache-Control "max-age=31536000, public
> {noformat}
> results in an call to abort() in matcher.h under ATS 7.0.0. This worked fine 
> under ATS 6.x (and probably 5.3.x)
> {noformat}
> (gdb) where
> #0  0x00007ffff4f64625 in *__GI_raise (sig=<optimized out>) at 
> ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1  0x00007ffff4f65e05 in *__GI_abort () at abort.c:92
> #2  0x00007fffe71dd3ff in Matchers<std::string>::setRegex 
> (this=this@entry=0x7fffe5ac0f80) at matcher.h:98
> #3  0x00007fffe71d7baa in Matchers<std::string>::set (d=..., 
> this=0x7fffe5ac0f80) at matcher.h:119
> #4  ConditionPath::initialize (this=0x7fffe59a6d00, p=...) at 
> conditions.cc:260
> {noformat}
> The string comes to matcher with the escapes removed:
> {noformat}
> Adding condition: %{PATH} with arg: /(.html|.js|.png)(?:?(.*))*$/
> {noformat}
> If I add quotes around the regex, this regex is passed through correctly 
> escaped.
> Not sure if this is expected behavior or not. 
> This also seems related to TS-4797 and TS-4940. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to