]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: channel: Don't test CF_READ_NULL while CF_SHUTR is enough
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Dec 2022 06:53:18 +0000 (07:53 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 9 Jan 2023 17:41:08 +0000 (18:41 +0100)
If CF_READ_NULL flag is set on a channel, it implies a shutdown for reads
was performed and CF_SHUTR is also set on this channel. Thus, there is no
reason to test is any of these flags is present, testing CF_SHUTR is enough.

src/cli.c
src/http_ana.c

index 2cbc89e11aec77b25648eab6d93fa1ee715be234..79e7e5d4dd4fdc0a8cbbb62d4e8e404f96da1781 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -2694,7 +2694,7 @@ int pcli_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
                return 0;
        }
 
-       if ((rep->flags & (CF_SHUTR|CF_READ_NULL))) {
+       if (rep->flags & CF_SHUTR) {
                /* stream cleanup */
 
                pcli_write_prompt(s);
index 078d8beb618f3e246a5f1e49d23a3fd171de6854..1c752d3fc80b75642c855c4f411bf512b7e4c1a4 100644 (file)
@@ -1142,7 +1142,7 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
         * it can be abused to exhaust source ports. */
        if (s->be->options & PR_O_ABRT_CLOSE) {
                channel_auto_read(req);
-               if ((req->flags & (CF_SHUTR|CF_READ_NULL)) && !(txn->flags & TX_CON_WANT_TUN))
+               if ((req->flags & CF_SHUTR) && !(txn->flags & TX_CON_WANT_TUN))
                        s->scb->flags |= SC_FL_NOLINGER;
                channel_auto_close(req);
        }
@@ -2833,7 +2833,7 @@ static enum rule_result http_req_get_intercept_rule(struct proxy *px, struct lis
                /* Always call the action function if defined */
                if (rule->action_ptr) {
                        if ((s->req.flags & CF_READ_ERROR) ||
-                           ((s->req.flags & (CF_SHUTR|CF_READ_NULL)) &&
+                           ((s->req.flags & CF_SHUTR) &&
                             (px->options & PR_O_ABRT_CLOSE)))
                                act_opts |= ACT_OPT_FINAL;
 
@@ -2996,7 +2996,7 @@ resume_execution:
                /* Always call the action function if defined */
                if (rule->action_ptr) {
                        if ((s->req.flags & CF_READ_ERROR) ||
-                           ((s->req.flags & (CF_SHUTR|CF_READ_NULL)) &&
+                           ((s->req.flags & CF_SHUTR) &&
                             (px->options & PR_O_ABRT_CLOSE)))
                                act_opts |= ACT_OPT_FINAL;