BUG/MINOR: cache: Manage multiple values in cache-control header value
authorRemi Tricot-Le Breton <rlebreton@haproxy.com>
Wed, 28 Oct 2020 10:35:15 +0000 (11:35 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 30 Oct 2020 12:28:34 +0000 (13:28 +0100)
commit40ed97b04b930c76c77c09c0cafc8781f94b66ee
treee81922cb259eb988d136e4c34b4b05adc5c21572
parentbb4582cf719bcf9facf4e9b459fd3a68a97fffbd
BUG/MINOR: cache: Manage multiple values in cache-control header value

If an HTTP request or response had a "Cache-Control" header that had
multiple comma-separated subparts in its value (like "max-age=1,
no-store" for instance), we did not process the values correctly and
only parsed the first one. That made us store some HTTP responses in the
cache when they were explicitely uncacheable.
This patch replaces the way the values are parsed by an http_find_header
loop that manages every sub part of the value independently.

This patch should be backported to 2.2 and 2.1. The bug also exists on
previous versions but since the sources changed, a new commit will have
to be created.

[wla: This patch requires bb4582c ("MINOR: ist: Add a case insensitive
istmatch function"). Backporting for < 2.1 is not a requirement since it
works well enough for most cases, it was a known limitation of the
implementation of non-htx version too]
src/http_ana.c