Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4993

Backslash/escape removed from header_rewrite rule when unquoted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 7.0.0
    • 7.0.0
    • Plugins
    • None

    Description

      Loading up a configuration with a header_rewrite rule of:

      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
      

      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)

      (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
      

      The string comes to matcher with the escapes removed:

      Adding condition: %{PATH} with arg: /(.html|.js|.png)(?:?(.*))*$/
      

      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.

      Attachments

        Issue Links

          Activity

            People

              zwoop Leif Hedstrom
              randall Randall Leeds
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m