From: Tim Duesterhus Date: Sat, 2 Jan 2021 21:47:17 +0000 (+0100) Subject: CLEANUP: Reduce scope of `hdr_age` in http_action_store_cache() X-Git-Tag: v2.4-dev5~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c294284e3354984e9d58daeace796dae56d9022c;p=thirdparty%2Fhaproxy.git CLEANUP: Reduce scope of `hdr_age` in http_action_store_cache() This is only required to process the `age` header. --- diff --git a/src/cache.c b/src/cache.c index b7ea562a7d..9485caa005 100644 --- a/src/cache.c +++ b/src/cache.c @@ -977,7 +977,6 @@ static void set_secondary_key_encoding(struct htx *htx, char *secondary_key) enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px, struct session *sess, struct stream *s, int flags) { - long long hdr_age; int effective_maxage = 0; int true_maxage = 0; struct http_txn *txn = s->txn; @@ -1147,6 +1146,7 @@ enum act_return http_action_store_cache(struct act_rule *rule, struct proxy *px, ctx.blk = NULL; if (http_find_header(htx, ist("Age"), &ctx, 0)) { + long long hdr_age; if (!strl2llrc(ctx.value.ptr, ctx.value.len, &hdr_age) && hdr_age > 0) { if (unlikely(hdr_age > CACHE_ENTRY_MAX_AGE)) hdr_age = CACHE_ENTRY_MAX_AGE;