]> git.kaiwu.me - nginx.git/commitdiff
do not cache response if it has "no-store" or "private"
authorIgor Sysoev <igor@sysoev.ru>
Fri, 14 May 2010 12:04:58 +0000 (12:04 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 14 May 2010 12:04:58 +0000 (12:04 +0000)
in "Cache-Control" header

src/http/ngx_http_upstream.c

index e6bef3c0471eb86ccaeb67a36a97a5bbdf6843ca..eaf54812f2d21f019658a41e20cc4961c87ff7c7 100644 (file)
@@ -3023,16 +3023,18 @@ ngx_http_upstream_process_cache_control(ngx_http_request_t *r,
         return NGX_OK;
     }
 
-    last = h->value.data + h->value.len;
+    p = h->value.data;
+    last = p + h->value.len;
 
-    if (ngx_strlcasestrn(h->value.data, last, (u_char *) "no-cache", 8 - 1)
-        != NULL)
+    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;