]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: "option checkcache" fails with the no-cache header
authorWilly Tarreau <w@1wt.eu>
Thu, 4 Jul 2013 10:46:56 +0000 (12:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 4 Jul 2013 10:49:28 +0000 (12:49 +0200)
The checkcache option checks for cacheable responses with a set-cookie
header. Since the response processing code was refactored in 1.3.8
(commit a15645d4), the check was broken because the no-cache value
is only checked as no-cache="set-cookie", and not alone.

Thanks to HervĂ© Commowick for reporting this stupid bug!

The fix should be backported to 1.4 and 1.3.

src/proto_http.c

index 8c336e6bb63e358c29314f104910c5bdc7d9b78c..5a1451a702c10113f2b9d1fe317841e10e271805 100644 (file)
@@ -7870,6 +7870,7 @@ void check_response_for_cacheability(struct session *t, struct channel *rtr)
 
                /* OK, so we know that either p2 points to the end of string or to a comma */
                if (((p2 - p1 ==  7) && strncasecmp(p1, "private", 7) == 0) ||
+                   ((p2 - p1 ==  8) && strncasecmp(p1, "no-cache", 8) == 0) ||
                    ((p2 - p1 ==  8) && strncasecmp(p1, "no-store", 8) == 0) ||
                    ((p2 - p1 ==  9) && strncasecmp(p1, "max-age=0", 9) == 0) ||
                    ((p2 - p1 == 10) && strncasecmp(p1, "s-maxage=0", 10) == 0)) {