MINOR: stream: Add http-buffer-request option in the waiting entities

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.
This commit is contained in:
Christopher Faulet 2024-10-31 14:16:01 +01:00
parent c64712b085
commit 64554a55f4
3 changed files with 14 additions and 3 deletions

View 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

View 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;

View 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;