]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cache: do not try to retrieve host-less requests from the cache
authorWilly Tarreau <w@1wt.eu>
Fri, 22 Dec 2017 15:32:43 +0000 (16:32 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 22 Dec 2017 16:56:17 +0000 (17:56 +0100)
All HTTP/1.1 requests the Host header share the same hash key 0 and
will be return the first cached object. Let's add the check on the call
to sha1_hosturi() to prevent this from happening.

This must be backported to 1.8.

src/cache.c

index 459c2e8bf5acd27c2951ec7f83eb1b9dd947503c..371ce20acd540c35432f84eb4d2d7c79932cfe8f 100644 (file)
@@ -672,7 +672,8 @@ enum act_return http_action_req_cache_use(struct act_rule *rule, struct proxy *p
        struct cache_entry *res;
        struct cache *cache = (struct cache *)rule->arg.act.p[0];
 
-       sha1_hosturi(s->txn);
+       if (!sha1_hosturi(s->txn))
+               return ACT_RET_CONT;
 
        shctx_lock(shctx_ptr(cache));
        res = entry_exist(cache, s->txn->cache_hash);