]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http-rules: Add capture action to http-after-response ruleset
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 6 Dec 2021 07:43:22 +0000 (08:43 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 7 Dec 2021 18:04:33 +0000 (19:04 +0100)
It is now possible to perform captures on the response when
http-after-response rules are evaluated. It may be handy to capture headers
from responses generated by HAProxy.

This patch is trivial, it may be backported if necessary.

doc/configuration.txt
src/http_act.c

index 6a0511067c425c1ac48cf5acb6b376de9103ea10..1e049012be0314fb7b5facc41eb4872b38c37737 100644 (file)
@@ -5320,6 +5320,7 @@ http-after-response <action> <options...> [ { if | unless } <condition> ]
   supported:
     - add-header <name> <fmt>
     - allow
+    - capture <sample> id <id>
     - del-header <name> [ -m <meth> ]
     - replace-header <name> <regex-match> <replace-fmt>
     - replace-value <name> <regex-match> <replace-fmt>
@@ -5357,6 +5358,12 @@ http-after-response add-header <name> <fmt> [ { if | unless } <condition> ]
   value is defined by <fmt>. Please refer to "http-request add-header" for a
   complete description.
 
+http-after-response capture <sample> id <id> [ { if | unless } <condition> ]
+
+  This captures sample expression <sample> from the response buffer, and
+  converts it to a string. Please refer to "http-response capture" for a
+  complete description.
+
 http-after-response allow [ { if | unless } <condition> ]
 
   This stops the evaluation of the rules and lets the response pass the check.
index 10cf243acba57bce1e86e9e5699c87605a9dde08..fc9306cb8a586f48e996d9b781d41f6ecff3c8ea 100644 (file)
@@ -2478,6 +2478,7 @@ static struct action_kw_list http_after_res_actions = {
        .kw = {
                { "add-header",      parse_http_set_header,     0 },
                { "allow",           parse_http_allow,          0 },
+               { "capture",         parse_http_res_capture,    0 },
                { "del-header",      parse_http_del_header,     0 },
                { "replace-header",  parse_http_replace_header, 0 },
                { "replace-value",   parse_http_replace_header, 0 },