diff options
author | Christopher Faulet <cfaulet@haproxy.com> | 2020-09-30 17:33:22 +0200 |
---|---|---|
committer | Christopher Faulet <cfaulet@haproxy.com> | 2020-11-20 13:01:26 +0100 |
commit | daf240d27895ace9df5dad93c0be33d31e579016 (patch) | |
tree | 3f30ad86553b6a1ef5916ad61629921bdb5a37d4 | |
parent | 10c8a61aa683866eb4668e9a6ae70d30422d0020 (diff) | |
download | haproxy-daf240d27895ace9df5dad93c0be33d31e579016.tar.gz |
MINOR: mux-h1: Disable reads if an error was reported on the H1 stream
Don't try to read more data if a parsing or a formatting error was reported on
the H1 stream. There is no reason to continue to process the messages fo the
current connection in this case. If a parsing error occurs, it means the input
is invalid. If a formatting error occurs, it is an internal error and it is
probably safer to give up.
-rw-r--r-- | src/mux_h1.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mux_h1.c b/src/mux_h1.c index 3cab3f118..b5259da19 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -356,11 +356,14 @@ static void h1_trace(enum trace_level level, uint64_t mask, const struct trace_s /* * Indicates whether or not we may receive data. The rules are the following : * - if an error or a shutdown for reads was detected on the connection we - must not attempt to receive + * must not attempt to receive + * - if we are waiting for the connection establishment, we must not attempt + * to receive + * - if an error was detected on the stream we must not attempt to receive + * - if reads are explicitly disabled, we must not attempt to receive * - if the input buffer failed to be allocated or is full , we must not try * to receive - * - if he input processing is busy waiting for the output side, we may - * attempt to receive + * - if the mux is not blocked on an input condition, we may attempt to receive * - otherwise must may not attempt to receive */ static inline int h1_recv_allowed(const struct h1c *h1c) @@ -375,6 +378,11 @@ static inline int h1_recv_allowed(const struct h1c *h1c) return 0; } + if (h1c->h1s && (h1c->h1s->flags & H1S_F_ERROR)) { + TRACE_DEVEL("recv not allowed because of error on h1s", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn); + return 0; + } + if (h1c->flags & H1C_F_DONT_READ) { TRACE_DEVEL("recv not allowed because dont_read", H1_EV_H1C_RECV|H1_EV_H1C_BLK, h1c->conn); return 0; |