diff --git a/reg-tests/connection/tcp_to_http_upgrade.vtc b/reg-tests/connection/tcp_to_http_upgrade.vtc index 093ba48e1..48ebebaef 100644 --- a/reg-tests/connection/tcp_to_http_upgrade.vtc +++ b/reg-tests/connection/tcp_to_http_upgrade.vtc @@ -155,6 +155,13 @@ client c_err3 -connect ${h1_err3h1_sock} { expect_close } -run +# TCP > HTTP upgrade with a parsing error +client c_err4 -connect ${h1_fe2h1_sock} { + send "GET / BAD-VERSION\r\n\r\n" + rxresp + expect resp.status == 400 +} -run + # To be sure no other request was received by the server client c_end -connect ${s1_sock} { txreq diff --git a/src/mux_h1.c b/src/mux_h1.c index a8421b76c..c511cfede 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2629,7 +2629,8 @@ static int h1_send_error(struct h1c *h1c) } } - if (h1c->h1s) { + if (h1c->state == H1_CS_EMBRYONIC) { + BUG_ON(h1c->h1s == NULL || h1s_sc(h1c->h1s) == NULL); TRACE_DEVEL("Abort embryonic H1S", H1_EV_H1C_ERR, h1c->conn, h1c->h1s); h1s_destroy(h1c->h1s); }