From: Willy Tarreau Date: Mon, 11 May 2026 12:54:01 +0000 (+0200) Subject: CLEANUP: http-rules: fix a few '&' vs '&&' checks for clarity X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=e4e614022b682b56e16285c0422d7cff098eb883;p=haproxy.git 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(). --- 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; }