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

zwoop 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 456ce6963e autest: adds a hrw test for LAST-CAPTURE group (#12814)
456ce6963e is described below

commit 456ce6963e81b229959c9534c8edb5b28ed15f17
Author: Leif Hedstrom <[email protected]>
AuthorDate: Thu Jan 15 17:14:19 2026 -0700

    autest: adds a hrw test for LAST-CAPTURE group (#12814)
---
 .../header_rewrite_bundle.replay.yaml              | 57 ++++++++++++++++------
 .../header_rewrite/rules/regex_tests.conf          |  7 ++-
 2 files changed, 46 insertions(+), 18 deletions(-)

diff --git 
a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_bundle.replay.yaml 
b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_bundle.replay.yaml
index d778c0c8c5..5577ef86c7 100644
--- 
a/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_bundle.replay.yaml
+++ 
b/tests/gold_tests/pluginTest/header_rewrite/header_rewrite_bundle.replay.yaml
@@ -754,17 +754,42 @@ sessions:
         - [ X-Match-2, { value: yes, as: equal } ]
         - [ X-Match, { as: absent } ]
 
-# Test 19: set-body with empty string
+# Test 19: Regex test - query parameter capture
 - transactions:
   - client-request:
       method: "GET"
       version: "1.1"
-      url: /from_10/
+      url: /from_9/?uid=123
       headers:
         fields:
         - [ Host, www.example.com ]
         - [ uuid, 25 ]
 
+    server-response:
+      status: 200
+      reason: OK
+      headers:
+        fields:
+        - [ Connection, close ]
+
+    proxy-response:
+      status: 200
+      headers:
+        fields:
+        - [ X-Match-3, { value: "123", as: equal } ]
+        - [ X-Match-2, { as: absent } ]
+
+# Test 20: set-body with empty string
+- transactions:
+  - client-request:
+      method: "GET"
+      version: "1.1"
+      url: /from_10/
+      headers:
+        fields:
+        - [ Host, www.example.com ]
+        - [ uuid, 26 ]
+
     server-response:
       status: 200
       reason: OK
@@ -784,7 +809,7 @@ sessions:
       content:
         size: 0
 
-# Test 20: set-body with STATUS variable
+# Test 21: set-body with STATUS variable
 - transactions:
   - client-request:
       method: "GET"
@@ -793,7 +818,7 @@ sessions:
       headers:
         fields:
         - [ Host, www.example.com ]
-        - [ uuid, 26 ]
+        - [ uuid, 27 ]
 
     server-response:
       status: 200
@@ -814,7 +839,7 @@ sessions:
       content:
         data: "200"
 
-# Test 21: Nested if/elif/else - X-Foo=foo + X-Bar=bar path
+# Test 22: Nested if/elif/else - X-Foo=foo + X-Bar=bar path
 - transactions:
   - client-request:
       method: "GET"
@@ -825,7 +850,7 @@ sessions:
         - [ Host, www.example.com ]
         - [ X-Foo, "foo" ]
         - [ X-Bar, "bar" ]
-        - [ uuid, 27 ]
+        - [ uuid, 28 ]
 
     server-response:
       status: 200
@@ -845,7 +870,7 @@ sessions:
         - [ X-Fie-Anywhere, { as: absent } ]
         - [ X-When-200-After, { value: "Yes", as: equal } ]
 
-# Test 22: Nested if/elif/else - X-Foo=foo + X-Fie=fie path
+# Test 23: Nested if/elif/else - X-Foo=foo + X-Fie=fie path
 - transactions:
   - client-request:
       method: "GET"
@@ -856,7 +881,7 @@ sessions:
         - [ Host, www.example.com ]
         - [ X-Foo, "foo" ]
         - [ X-Fie, "fie" ]
-        - [ uuid, 28 ]
+        - [ uuid, 29 ]
 
     server-response:
       status: 200
@@ -876,7 +901,7 @@ sessions:
         - [ X-Fie-Anywhere, { value: "Yes", as: equal } ]
         - [ X-When-200-After, { value: "Yes", as: equal } ]
 
-# Test 23: Nested if/elif/else - X-Foo=maybe path
+# Test 24: Nested if/elif/else - X-Foo=maybe path
 - transactions:
   - client-request:
       method: "GET"
@@ -886,7 +911,7 @@ sessions:
         fields:
         - [ Host, www.example.com ]
         - [ X-Foo, "maybe" ]
-        - [ uuid, 29 ]
+        - [ uuid, 30 ]
 
     server-response:
       status: 200
@@ -906,7 +931,7 @@ sessions:
         - [ X-Fie-Anywhere, { as: absent } ]
         - [ X-When-200-After, { value: "Yes", as: equal } ]
 
-# Test 24: Nested if/elif/else - X-Foo=definitely path
+# Test 25: Nested if/elif/else - X-Foo=definitely path
 - transactions:
   - client-request:
       method: "GET"
@@ -916,7 +941,7 @@ sessions:
         fields:
         - [ Host, www.example.com ]
         - [ X-Foo, "definitely" ]
-        - [ uuid, 30 ]
+        - [ uuid, 31 ]
 
     server-response:
       status: 200
@@ -936,7 +961,7 @@ sessions:
         - [ X-Fie-Anywhere, { as: absent } ]
         - [ X-When-200-After, { value: "Yes", as: equal } ]
 
-# Test 25: Nested if/elif/else - else path (no X-Foo)
+# Test 26: Nested if/elif/else - else path (no X-Foo)
 - transactions:
   - client-request:
       method: "GET"
@@ -945,7 +970,7 @@ sessions:
       headers:
         fields:
         - [ Host, www.example.com ]
-        - [ uuid, 31 ]
+        - [ uuid, 32 ]
 
     server-response:
       status: 200
@@ -965,7 +990,7 @@ sessions:
         - [ X-Fie-Anywhere, { as: absent } ]
         - [ X-When-200-After, { value: "Yes", as: equal } ]
 
-# Test 26: Nested if/elif/else - else path with X-Fie
+# Test 27: Nested if/elif/else - else path with X-Fie
 - transactions:
   - client-request:
       method: "GET"
@@ -975,7 +1000,7 @@ sessions:
         fields:
         - [ Host, www.example.com ]
         - [ X-Fie, "fie" ]
-        - [ uuid, 32 ]
+        - [ uuid, 33 ]
 
     server-response:
       status: 200
diff --git a/tests/gold_tests/pluginTest/header_rewrite/rules/regex_tests.conf 
b/tests/gold_tests/pluginTest/header_rewrite/rules/regex_tests.conf
index 2869b36530..8695244eaf 100644
--- a/tests/gold_tests/pluginTest/header_rewrite/rules/regex_tests.conf
+++ b/tests/gold_tests/pluginTest/header_rewrite/rules/regex_tests.conf
@@ -20,8 +20,11 @@ cond %{CLIENT-HEADER:X-Test1} /^[Ff]o+[bB]ar/
    set-header X-Match "yes"
 
 cond %{SEND_RESPONSE_HDR_HOOK} [AND]
-cond %{CLIENT-HEADER:X-We-Set} /^fie[0-9]+fum$/ [NOCASE]
-   set-header X-Match-2 "yes"
+cond %{CLIENT-URL:QUERY} /uid=([0-9]+)/
+   set-header X-Match-3 "%{LAST-CAPTURE:1}"
+elif
+   cond %{CLIENT-HEADER:X-We-Set} /^fie[0-9]+fum$/ [NOCASE]
+      set-header X-Match-2 "yes"
 
 cond %{REMAP_PSEUDO_HOOK} [AND]
 cond %{CLIENT-URL:PATH} /^from/

Reply via email to