]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: cache: Prepare helper functions for Vary support
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Mon, 16 Nov 2020 14:56:08 +0000 (15:56 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 24 Nov 2020 15:52:57 +0000 (16:52 +0100)
commit3d08236cb344607557f22e00cf1cc3e321a1fa95
tree98a0f2258464a79310cc466698138c2f06c89b42
parent401e6dbff3ee0b1932f6a16e3f280246752a7edf
MINOR: cache: Prepare helper functions for Vary support

The Vary functionality is based on a secondary key that needs to be
calculated for every request to which a server answers with a Vary
header. The Vary header, which can only be found in server responses,
determines which headers of the request need to be taken into account in
the secondary key. Since we do not want to have to store all the headers
of the request until we have the response, we will pre-calculate as many
sub-hashes as there are headers that we want to manage in a Vary
context. We will only focus on a subset of headers which are likely to
be mentioned in a Vary response (accept-encoding and referer for now).
Every managed header will have its own normalization function which is
in charge of transforming the header value into a core representation,
more robust to insignificant changes that could exist between multiple
clients. For instance, two accept-encoding values mentioning the same
encodings but in different orders should give the same hash.
This patch adds a function that parses a Vary header value and checks if
all the values belong to our supported subset. It also adds the
normalization functions for our two headers, as well as utility
functions that can prebuild a secondary key for a given request and
transform it into an actual secondary key after the vary signature is
determined from the response.
include/haproxy/http_ana-t.h
src/cache.c