From e4e614022b682b56e16285c0422d7cff098eb883 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 11 May 2026 14:54:01 +0200 Subject: [PATCH] CLEANUP: http-rules: fix a few '&' vs '&&' checks for clarity In http_re{q,s}_get_intercept_rule(), there are two occurrences of '&' being used instead of '&&' which fortunately work thanks to the tests being negations (hence 0/1 on each branch). Let's fix that and take this opportunity for adding explicit precedence in http_apply_redirect_rule(). --- src/http_ana.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/http_ana.c b/src/http_ana.c index fbe529866..c687b57d9 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -2528,7 +2528,7 @@ int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struc size_t len = build_logline(s, chunk->area + chunk->data, chunk->size - chunk->data, &rule->rdr_fmt); - if (!len && rule->flags & REDIRECT_FLAG_IGNORE_EMPTY) { + if (!len && (rule->flags & REDIRECT_FLAG_IGNORE_EMPTY)) { ret = 2; goto out; } @@ -2879,7 +2879,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->scf->flags & SC_FL_ERROR) & !(s->req.flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT))) { + if (!(s->scf->flags & SC_FL_ERROR) && !(s->req.flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT))) { s->waiting_entity.type = STRM_ENTITY_NONE; s->waiting_entity.ptr = NULL; } @@ -3071,7 +3071,7 @@ resume_execution: /* Always call the action function if defined */ if (rule->action_ptr) { - if (!(s->scb->flags & SC_FL_ERROR) & !(s->res.flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT))) { + if (!(s->scb->flags & SC_FL_ERROR) && !(s->res.flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT))) { s->waiting_entity.type = STRM_ENTITY_NONE; s->waiting_entity.ptr = NULL; } -- 2.47.3