mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
MINOR: mux-h1: Add flag on H1 stream to deal with internal errors
A new error is added on H1 stream to deal with internal errors. For now, this error is only reported when we fail to create a stream-connector. This way, the error is reported at the H1 stream level and not the H1 connection level.
This commit is contained in:
parent
56a499475f
commit
bef8900cd6
@ -92,11 +92,11 @@ static forceinline char *h1c_show_flags(char *buf, size_t len, const char *delim
|
||||
#define H1S_F_NOT_FIRST 0x00000080 /* The H1 stream is not the first one */
|
||||
#define H1S_F_BODYLESS_RESP 0x00000100 /* Bodyless response message */
|
||||
|
||||
/* 0x00000200 unused */
|
||||
#define H1S_F_INTERNAL_ERROR 0x00000200 /* Set when an internal error occurred during the message parsing */
|
||||
#define H1S_F_NOT_IMPL_ERROR 0x00000400 /* Set when a feature is not implemented during the message parsing */
|
||||
#define H1S_F_PARSING_ERROR 0x00000800 /* Set when an error occurred during the message parsing */
|
||||
#define H1S_F_PROCESSING_ERROR 0x00001000 /* Set when an error occurred during the message xfer */
|
||||
#define H1S_F_ERROR_MASK 0x00001800 /* stream error mask */
|
||||
#define H1S_F_ERROR_MASK 0x00003800 /* stream error mask */
|
||||
|
||||
#define H1S_F_HAVE_SRV_NAME 0x00002000 /* Set during output process if the server name header was added to the request */
|
||||
#define H1S_F_HAVE_O_CONN 0x00004000 /* Set during output process to know connection mode was processed */
|
||||
@ -114,8 +114,8 @@ static forceinline char *h1s_show_flags(char *buf, size_t len, const char *delim
|
||||
_(H1S_F_RX_BLK, _(H1S_F_TX_BLK, _(H1S_F_RX_CONGESTED,
|
||||
_(H1S_F_REOS, _(H1S_F_WANT_KAL, _(H1S_F_WANT_TUN, _(H1S_F_WANT_CLO,
|
||||
_(H1S_F_NOT_FIRST, _(H1S_F_BODYLESS_RESP,
|
||||
_(H1S_F_NOT_IMPL_ERROR, _(H1S_F_PARSING_ERROR, _(H1S_F_PROCESSING_ERROR,
|
||||
_(H1S_F_HAVE_SRV_NAME, _(H1S_F_HAVE_O_CONN))))))))))))));
|
||||
_(H1S_F_INTERNAL_ERROR, _(H1S_F_NOT_IMPL_ERROR, _(H1S_F_PARSING_ERROR, _(H1S_F_PROCESSING_ERROR,
|
||||
_(H1S_F_HAVE_SRV_NAME, _(H1S_F_HAVE_O_CONN)))))))))))))));
|
||||
/* epilogue */
|
||||
_(~0U);
|
||||
return buf;
|
||||
|
12
src/mux_h1.c
12
src/mux_h1.c
@ -1732,7 +1732,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
|
||||
h1m = (!(h1c->flags & H1C_F_IS_BACK) ? &h1s->req : &h1s->res);
|
||||
data = htx->data;
|
||||
|
||||
if (h1s->flags & (H1S_F_PARSING_ERROR|H1S_F_NOT_IMPL_ERROR))
|
||||
if (h1s->flags & (H1S_F_INTERNAL_ERROR|H1S_F_PARSING_ERROR|H1S_F_NOT_IMPL_ERROR))
|
||||
goto end;
|
||||
|
||||
if (h1s->flags & H1S_F_RX_BLK)
|
||||
@ -1850,7 +1850,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
|
||||
TRACE_DEVEL("request headers fully parsed, create and attach the SC", H1_EV_RX_DATA, h1c->conn, h1s);
|
||||
BUG_ON(h1s_sc(h1s));
|
||||
if (!h1s_new_sc(h1s, buf)) {
|
||||
h1c->flags |= H1C_F_ERROR;
|
||||
h1s->flags |= H1S_F_INTERNAL_ERROR;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
@ -1858,7 +1858,7 @@ static size_t h1_process_demux(struct h1c *h1c, struct buffer *buf, size_t count
|
||||
TRACE_DEVEL("request headers fully parsed, upgrade the inherited SC", H1_EV_RX_DATA, h1c->conn, h1s);
|
||||
BUG_ON(h1s_sc(h1s) == NULL);
|
||||
if (!h1s_upgrade_sc(h1s, buf)) {
|
||||
h1c->flags |= H1C_F_ERROR;
|
||||
h1s->flags |= H1S_F_INTERNAL_ERROR;
|
||||
TRACE_ERROR("H1S upgrade failure", H1_EV_RX_DATA|H1_EV_H1S_ERR, h1c->conn, h1s);
|
||||
goto err;
|
||||
}
|
||||
@ -1953,7 +1953,7 @@ static size_t h1_process_mux(struct h1c *h1c, struct buffer *buf, size_t count)
|
||||
if (htx_is_empty(chn_htx))
|
||||
goto end;
|
||||
|
||||
if (h1s->flags & (H1S_F_PROCESSING_ERROR|H1S_F_TX_BLK))
|
||||
if (h1s->flags & (H1S_F_INTERNAL_ERROR|H1S_F_PROCESSING_ERROR|H1S_F_TX_BLK))
|
||||
goto end;
|
||||
|
||||
if (!h1_get_buf(h1c, &h1c->obuf)) {
|
||||
@ -2970,9 +2970,9 @@ static int h1_process(struct h1c * h1c)
|
||||
h1_set_idle_expiration(h1c);
|
||||
|
||||
no_parsing:
|
||||
if (h1c->flags & H1C_F_ERROR) {
|
||||
if (h1s->flags & H1S_F_INTERNAL_ERROR) {
|
||||
h1_handle_internal_err(h1c);
|
||||
h1c->flags &= ~H1C_F_WAIT_NEXT_REQ;
|
||||
h1c->flags = (h1c->flags & ~H1C_F_WAIT_NEXT_REQ) | H1C_F_ERROR;
|
||||
TRACE_ERROR("internal error detected", H1_EV_H1C_WAKE|H1_EV_H1C_ERR);
|
||||
}
|
||||
else if (h1s->flags & H1S_F_NOT_IMPL_ERROR) {
|
||||
|
Loading…
Reference in New Issue
Block a user