]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mux-h1: Avoid useless call to h1_send() if no error is sent
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Nov 2022 16:13:12 +0000 (17:13 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 23 Nov 2022 16:13:13 +0000 (17:13 +0100)
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.

src/mux_h1.c

index ae7d839154048f9147bbf2c3d460de0ac96f1be4..c1fcc256a4774d8b3c1eee2bf3a0b374c07ea524 100644 (file)
@@ -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;