From 9f2080114f79f64051e17b12957655e26c46bdf0 Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w@1wt.eu>
Date: Thu, 4 Jul 2013 12:46:56 +0200
Subject: [PATCH 2/2] BUG/MEDIUM: http: "option checkcache" fails with the
 no-cache header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.
(cherry picked from commit 5b15f9004d13b8a7e5e665929cad97a2c0beebd3)
---
 src/proto_http.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/proto_http.c b/src/proto_http.c
index a63d65d..22a7737 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -7373,6 +7373,7 @@ void check_response_for_cacheability(struct session *t, struct buffer *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)) {
-- 
1.8.1.5