Skip to content

Commit 64554a5

Browse files
committed
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.
1 parent c64712b commit 64554a5

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

include/haproxy/stream-t.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ enum {
161161
* depending on the context;
162162
*/
163163
enum {
164-
STRM_ENTITY_NONE = 0x0000,
165-
STRM_ENTITY_RULE = 0x0001,
166-
STRM_ENTITY_FILTER = 0x0002,
164+
STRM_ENTITY_NONE = 0x0000,
165+
STRM_ENTITY_RULE = 0x0001,
166+
STRM_ENTITY_FILTER = 0x0002,
167+
STRM_ENTITY_WREQ_BODY = 0x0003,
167168
};
168169

169170
/* This function is used to report flags in debugging tools. Please reflect

src/http_ana.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,12 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
826826

827827
switch (http_wait_for_msg_body(s, req, s->be->timeout.httpreq, 0)) {
828828
case HTTP_RULE_RES_CONT:
829+
s->waiting_entity.type = STRM_ENTITY_NONE;
830+
s->waiting_entity.ptr = NULL;
829831
goto http_end;
830832
case HTTP_RULE_RES_YIELD:
833+
s->waiting_entity.type = STRM_ENTITY_WREQ_BODY;
834+
s->waiting_entity.ptr = NULL;
831835
goto missing_data_or_waiting;
832836
case HTTP_RULE_RES_BADREQ:
833837
goto return_bad_req;

src/stream.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4189,6 +4189,12 @@ static int smp_fetch_waiting_entity(const struct arg *args, struct sample *smp,
41894189
smp->data.u.str = *trash;
41904190
}
41914191
}
4192+
else if (smp->strm->waiting_entity.type == STRM_ENTITY_WREQ_BODY) {
4193+
struct buffer *trash = get_trash_chunk();
4194+
4195+
chunk_memcat(trash, "http-buffer-request", 19);
4196+
smp->data.u.str = *trash;
4197+
}
41924198
else
41934199
return 0;
41944200

0 commit comments

Comments
 (0)