]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: stream: Add http-buffer-request option in the waiting entities
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 31 Oct 2024 13:16:01 +0000 (14:16 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 31 Oct 2024 19:24:50 +0000 (20:24 +0100)
When http-buffer-request option is set on a proxy, the processing will be
paused to wait the full request payload or a full buffer. So it is an entity
that block the processing, just like a rule or a filter that yields. So now,
it is reported as a waiting entity if an error or a timeout occurred.

To do so, an stream entity type is added for this option. There is no
pointer. And "waiting_entity" sample fetch returns the option name.

include/haproxy/stream-t.h
src/http_ana.c
src/stream.c

index 0921cf0aa99730209266e9862c3a2eaf3b8f0d79..5da8101ed1959731821a507d091159878e18432a 100644 (file)
@@ -161,9 +161,10 @@ enum {
  * depending on the context;
  */
 enum {
-       STRM_ENTITY_NONE   = 0x0000,
-       STRM_ENTITY_RULE   = 0x0001,
-       STRM_ENTITY_FILTER = 0x0002,
+       STRM_ENTITY_NONE      = 0x0000,
+       STRM_ENTITY_RULE      = 0x0001,
+       STRM_ENTITY_FILTER    = 0x0002,
+       STRM_ENTITY_WREQ_BODY = 0x0003,
 };
 
 /* This function is used to report flags in debugging tools. Please reflect
index 05bc92383eac1b702bf0bfc1cd0605d2f9edf4c0..ecf417e5a1e5c0131a884a07fcb511c852eb880f 100644 (file)
@@ -826,8 +826,12 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
 
        switch (http_wait_for_msg_body(s, req, s->be->timeout.httpreq, 0)) {
        case HTTP_RULE_RES_CONT:
+               s->waiting_entity.type = STRM_ENTITY_NONE;
+               s->waiting_entity.ptr = NULL;
                goto http_end;
        case HTTP_RULE_RES_YIELD:
+               s->waiting_entity.type = STRM_ENTITY_WREQ_BODY;
+               s->waiting_entity.ptr = NULL;
                goto missing_data_or_waiting;
        case HTTP_RULE_RES_BADREQ:
                goto return_bad_req;
index e1a464971df5631522e165680b222d7df1faf69f..d6184aae03adb765a7439c95b66ea6050cfe4a56 100644 (file)
@@ -4189,6 +4189,12 @@ static int smp_fetch_waiting_entity(const struct arg *args, struct sample *smp,
                        smp->data.u.str = *trash;
                }
        }
+       else if (smp->strm->waiting_entity.type == STRM_ENTITY_WREQ_BODY) {
+               struct buffer *trash = get_trash_chunk();
+
+               chunk_memcat(trash, "http-buffer-request", 19);
+               smp->data.u.str = *trash;
+       }
        else
                return 0;