MEDIUM: cache: Add the Vary header support
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Mon, 16 Nov 2020 14:56:09 +0000 (15:56 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 24 Nov 2020 15:52:57 +0000 (16:52 +0100)
commit1785f3dd961e5fe2b0ede4b4af7baf4e20163f37
treeca8145d258f39379f231662401c6842da0c2f134
parent3d08236cb344607557f22e00cf1cc3e321a1fa95
MEDIUM: cache: Add the Vary header support

Calculate a preliminary secondary key for every request we see so that
we can have a real secondary key if the response is cacheable and
contains a manageable Vary header.
The cache's ebtree is now allowed to have multiple entries with the same
primary key. Two of those entries will be distinguished thanks to
secondary keys stored in the cache_entry (based on hashes of a subset of
their headers).
When looking for an entry in the cache (cache_use), we still use the
primary key (built the same way as before), but in case of match, we
also need to check if the entry has a vary signature. If it has one, we
need to perform an extra check based on the newly built secondary key.
We will only be able to forge a response out of the cache if both the
primary and secondary keys match with one of our entries. Otherwise the
request will be forwarder to the server.
reg-tests/cache/vary.vtc [new file with mode: 0644]
src/cache.c