]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: haterm: Report a 400-bad-request error on receive error
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 5 May 2026 16:31:57 +0000 (18:31 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 5 May 2026 17:07:59 +0000 (19:07 +0200)
When an error is reported when reading request data, the hstream now try to
send a 400-bad-request to the client. Before, the connection was just closed
with no error message.

src/haterm.c

index 5a5213a0b271c2d277381940d501ec31507a31e4..f79fb13713cd819c6747adcfda954b76571663f7 100644 (file)
@@ -1029,8 +1029,10 @@ static struct task *process_hstream(struct task *t, void *context, unsigned int
                /* HTX RX part */
                if (hstream_must_drain(hs)) {
                        rcvd = hstream_htx_buf_rcv(conn, hs);
-                       if (rcvd == 3) {
-                               TRACE_STATE("waiting for more data", HS_EV_HSTRM_RESP, hs);
+                       if (rcvd != 1) {
+                               if (rcvd == 2)
+                                       hstream_send_error(hs, conn, &http_err_chunks[HTTP_ERR_400]);
+                               TRACE_STATE("waiting for more data or error", HS_EV_HSTRM_RESP, hs);
                                goto out;
                        }
                }