From: Christopher Faulet Date: Wed, 23 Nov 2022 16:13:12 +0000 (+0100) Subject: MINOR: mux-h1: Avoid useless call to h1_send() if no error is sent X-Git-Tag: v2.7-dev10~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1b573059a;p=thirdparty%2Fhaproxy.git MINOR: mux-h1: Avoid useless call to h1_send() if no error is sent If we choose to not send an error to the client, there is no reason to call h1_send() for nothing. This happens because functions handling errors return 1 instead of 0 when nothing is performed. --- diff --git a/src/mux_h1.c b/src/mux_h1.c index ae7d839154..c1fcc256a4 100644 --- a/src/mux_h1.c +++ b/src/mux_h1.c @@ -2647,7 +2647,7 @@ static int h1_send_error(struct h1c *h1c) static int h1_handle_internal_err(struct h1c *h1c) { struct session *sess = h1c->conn->owner; - int ret = 1; + int ret = 0; session_inc_http_req_ctr(sess); proxy_inc_fe_req_ctr(sess->listener, sess->fe); @@ -2670,7 +2670,7 @@ static int h1_handle_internal_err(struct h1c *h1c) static int h1_handle_parsing_error(struct h1c *h1c) { struct session *sess = h1c->conn->owner; - int ret = 1; + int ret = 0; if (!b_data(&h1c->ibuf) && ((h1c->flags & H1C_F_WAIT_NEXT_REQ) || (sess->fe->options & PR_O_IGNORE_PRB))) { h1c->state = H1_CS_CLOSING; @@ -2703,7 +2703,7 @@ static int h1_handle_parsing_error(struct h1c *h1c) static int h1_handle_not_impl_err(struct h1c *h1c) { struct session *sess = h1c->conn->owner; - int ret = 1; + int ret = 0; if (!b_data(&h1c->ibuf) && ((h1c->flags & H1C_F_WAIT_NEXT_REQ) || (sess->fe->options & PR_O_IGNORE_PRB))) { h1c->state = H1_CS_CLOSING; @@ -2733,7 +2733,7 @@ static int h1_handle_not_impl_err(struct h1c *h1c) static int h1_handle_req_tout(struct h1c *h1c) { struct session *sess = h1c->conn->owner; - int ret = 1; + int ret = 0; if (!b_data(&h1c->ibuf) && ((h1c->flags & H1C_F_WAIT_NEXT_REQ) || (sess->fe->options & PR_O_IGNORE_PRB))) { h1c->state = H1_CS_CLOSING;