# HG changeset patch # User Igor Sysoev # Date 1273838698 0 # Node ID a4ee4a075ac5e585eff48c0cee4094bdbaa0b579 # Parent dd1570b6f23733885d6ec094a2d75d0816a4379a do not cache response if it has "no-store" or "private" in "Cache-Control" header diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -3023,16 +3023,18 @@ ngx_http_upstream_process_cache_control( return NGX_OK; } - last = h->value.data + h->value.len; - - if (ngx_strlcasestrn(h->value.data, last, (u_char *) "no-cache", 8 - 1) - != NULL) + p = h->value.data; + last = p + h->value.len; + + if (ngx_strlcasestrn(p, last, (u_char *) "no-cache", 8 - 1) != NULL + || ngx_strlcasestrn(p, last, (u_char *) "no-store", 8 - 1) != NULL + || ngx_strlcasestrn(p, last, (u_char *) "private", 7 - 1) != NULL) { u->cacheable = 0; return NGX_OK; } - p = ngx_strlcasestrn(h->value.data, last, (u_char *) "max-age=", 8 - 1); + p = ngx_strlcasestrn(p, last, (u_char *) "max-age=", 8 - 1); if (p == NULL) { return NGX_OK;