From 021a8e4d7bcd1687f24186435ddfc6e7a79f335b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 29 Mar 2021 10:46:38 +0200 Subject: [PATCH] MEDIUM: http-rules: Add wait-for-body action on request and response side Historically, an option was added to wait for the request payload (option http-buffer-request). This option has 2 drawbacks. First, it is an ON/OFF option for the whole proxy. It cannot be enabled on demand depending on the message. Then, as its name suggests, it only works on the request side. The only option to wait for the response payload was to write a dedicated filter. While it is an acceptable solution for complex applications, it is a bit overkill to simply match strings in the body. To make everyone happy, this patch adds a dedicated HTTP action to wait for the message payload, for the request or the response depending it is used in an http-request or an http-response ruleset. The time to wait is configurable and, optionally, the minimum payload size to have before stop to wait. Both the http action and the old http analyzer rely on the same internal function. --- doc/configuration.txt | 49 +++++++++- include/haproxy/http_ana.h | 1 + src/http_act.c | 107 ++++++++++++++++++++++ src/http_ana.c | 183 ++++++++++++++++++++++++++----------- 4 files changed, 285 insertions(+), 55 deletions(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 8c33a5ca7..565582ccb 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -6634,6 +6634,31 @@ http-request use-service [ { if | unless } ] Example: http-request use-service prometheus-exporter if { path /metrics } +http-request wait-for-body time