1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2025-04-07 01:31:35 +00:00

MINOR: http-rules: Add missing actions in http-after-response ruleset

This patch adds the support of following actions in the http-after-response
ruleset:

  * set-map, del-map and del-acl
  * set-log-level
  * sc-inc-gpc, sc-inc-gpc0 and set-inc-gpc1
  * sc-inc-gpt and sc-set-gpt0

This patch should solve the issue .
This commit is contained in:
Christopher Faulet 2023-01-05 11:17:38 +01:00
parent d9d36b8b6b
commit a92480462c
4 changed files with 68 additions and 0 deletions

View File

@ -5811,10 +5811,19 @@ http-after-response <action> <options...> [ { if | unless } <condition> ]
- add-header <name> <fmt>
- allow
- capture <sample> id <id>
- del-acl(<file-name>) <key fmt>
- del-header <name> [ -m <meth> ]
- del-map(<file-name>) <key fmt>
- replace-header <name> <regex-match> <replace-fmt>
- replace-value <name> <regex-match> <replace-fmt>
- sc-inc-gpc(<idx>,<sc-id>)
- sc-inc-gpc0(<sc-id>)
- sc-inc-gpc1(<sc-id>)
- sc-set-gpt(<idx>,<sc-id>) { <int> | <expr> }
- sc-set-gpt0(<sc-id>) { <int> | <expr> }
- set-header <name> <fmt>
- set-log-level <level>
- set-map(<file-name>) <key fmt> <value fmt>
- set-status <status> [reason <str>]
- set-var(<var-name>[,<cond> ...]) <expr>
- set-var-fmt(<var-name>[,<cond> ...]) <fmt>
@ -5859,11 +5868,21 @@ http-after-response capture <sample> id <id> [ { if | unless } <condition> ]
converts it to a string. Please refer to "http-response capture" for a
complete description.
http-after-response del-acl(<file-name>) <key fmt> [ { if | unless } <condition> ]
This is used to delete an entry from an ACL. Please refer to "http-request
del-acl" for a complete description.
http-after-response del-header <name> [ -m <meth> ] [ { if | unless } <condition> ]
This removes all HTTP header fields whose name is specified in <name>. Please
refer to "http-request del-header" for a complete description.
http-after-response del-map(<file-name>) <key fmt> [ { if | unless } <condition> ]
This is used to delete an entry from a MAP. Please refer to "http-request
del-map" for a complete description.
http-after-response replace-header <name> <regex-match> <replace-fmt>
[ { if | unless } <condition> ]
@ -5894,6 +5913,34 @@ http-after-response replace-value <name> <regex-match> <replace-fmt>
# outputs:
Cache-Control: max-age=3600, private
http-after-response sc-inc-gpc(<idx>,<sc-id>) [ { if | unless } <condition> ]
http-after-response sc-inc-gpc0(<sc-id>) [ { if | unless } <condition> ]
http-after-response sc-inc-gpc1(<sc-id>) [ { if | unless } <condition> ]
These actions increment the General Purppose Counters according to the sticky
counter designated by <sc-id>. Please refer to "http-request sc-inc-gpc",
"http-request sc-inc-gpc0" and "http-request sc-inc-gpc1" for a complete
description.
http-after-response sc-set-gpt(<idx>,<sc-id>) { <int> | <expr> }
[ { if | unless } <condition> ]
http-after-response sc-set-gpt0(<sc-id>) { <int> | <expr> }
[ { if | unless } <condition> ]
These actions set the 32-bit unsigned General Purpose Tags according to the
sticky counter designated by <sc-id>. Please refer to "http-request
sc-inc-gpt" and "http-request sc-inc-gpt0" for a complete description.
http-after-response set-log-level <level> [ { if | unless } <condition> ]
This is used to change the log level of the current response. Please refer to
"http-request set-log-level" for a complete description.
http-after-response set-map(<file-name>) <key fmt> <value fmt>
This is used to add a new entry into a MAP. Please refer to "http-request
set-map" for a complete description.
http-after-response set-header <name> <fmt> [ { if | unless } <condition> ]
This does the same as "http-after-response add-header" except that the header

View File

@ -2476,10 +2476,13 @@ static struct action_kw_list http_after_res_actions = {
{ "add-header", parse_http_set_header, 0 },
{ "allow", parse_http_allow, 0 },
{ "capture", parse_http_res_capture, 0 },
{ "del-acl", parse_http_set_map, KWF_MATCH_PREFIX },
{ "del-header", parse_http_del_header, 0 },
{ "del-map", parse_http_set_map, KWF_MATCH_PREFIX },
{ "replace-header", parse_http_replace_header, 0 },
{ "replace-value", parse_http_replace_header, 0 },
{ "set-header", parse_http_set_header, 0 },
{ "set-map", parse_http_set_map, KWF_MATCH_PREFIX },
{ "set-status", parse_http_set_status, 0 },
{ "strict-mode", parse_http_strict_mode, 0 },
{ NULL, NULL }

View File

@ -5077,6 +5077,17 @@ static struct action_kw_list http_res_kws = { { }, {
INITCALL1(STG_REGISTER, http_res_keywords_register, &http_res_kws);
static struct action_kw_list http_after_res_kws = { { }, {
{ "sc-inc-gpc", parse_inc_gpc, KWF_MATCH_PREFIX },
{ "sc-inc-gpc0", parse_inc_gpc, KWF_MATCH_PREFIX },
{ "sc-inc-gpc1", parse_inc_gpc, KWF_MATCH_PREFIX },
{ "sc-set-gpt", parse_set_gpt, KWF_MATCH_PREFIX },
{ "sc-set-gpt0", parse_set_gpt, KWF_MATCH_PREFIX },
{ /* END */ }
}};
INITCALL1(STG_REGISTER, http_after_res_keywords_register, &http_after_res_kws);
/* Note: must not be declared <const> as its list will be overwritten.
* Please take care of keeping this list alphabetically sorted.
*/

View File

@ -3942,6 +3942,13 @@ static struct action_kw_list stream_http_res_keywords = { ILH, {
INITCALL1(STG_REGISTER, http_res_keywords_register, &stream_http_res_keywords);
static struct action_kw_list stream_http_after_res_actions = { ILH, {
{ "set-log-level", stream_parse_set_log_level },
{ /* END */ }
}};
INITCALL1(STG_REGISTER, http_after_res_keywords_register, &stream_http_after_res_actions);
static int smp_fetch_cur_server_timeout(const struct arg *args, struct sample *smp, const char *km, void *private)
{
smp->flags = SMP_F_VOL_TXN;