From: Christopher Faulet Date: Mon, 6 Dec 2021 07:43:22 +0000 (+0100) Subject: MINOR: http-rules: Add capture action to http-after-response ruleset X-Git-Tag: v2.6-dev1~303 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba8f06304e538d763a506526a63285c33d26af47;p=thirdparty%2Fhaproxy.git MINOR: http-rules: Add capture action to http-after-response ruleset 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. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 6a0511067c..1e049012be 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -5320,6 +5320,7 @@ http-after-response [ { if | unless } ] supported: - add-header - allow + - capture id - del-header [ -m ] - replace-header - replace-value @@ -5357,6 +5358,12 @@ http-after-response add-header [ { if | unless } ] value is defined by . Please refer to "http-request add-header" for a complete description. +http-after-response capture id [ { if | unless } ] + + This captures sample expression 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 } ] This stops the evaluation of the rules and lets the response pass the check. diff --git a/src/http_act.c b/src/http_act.c index 10cf243acb..fc9306cb8a 100644 --- a/src/http_act.c +++ b/src/http_act.c @@ -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 },