[PATCH] Cache: check if ETag and Vary didn't change before updating header

Piotr Sikora piotr at cloudflare.com
Sun Dec 21 00:22:57 UTC 2014


# HG changeset patch
# User Piotr Sikora <piotr at cloudflare.com>
# Date 1419121345 28800
#      Sat Dec 20 16:22:25 2014 -0800
# Node ID 7e7f823e87fc02c55d46d74a65b336752afe17ee
# Parent  ee941e49bd8899d2beb3da9ec36acf3b56c5ce9e
Cache: check if ETag and Vary didn't change before updating header.

Signed-off-by: Piotr Sikora <piotr at cloudflare.com>

diff -r ee941e49bd88 -r 7e7f823e87fc src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c	Wed Dec 17 15:12:50 2014 +0100
+++ b/src/http/ngx_http_file_cache.c	Sat Dec 20 16:22:25 2014 -0800
@@ -1362,6 +1362,10 @@ ngx_http_file_cache_update_header(ngx_ht
 
     if (h.version != NGX_HTTP_CACHE_VERSION
         || h.last_modified != c->last_modified
+        || h.etag_len != c->etag.len
+        || ngx_memcmp(h.etag, c->etag.data, c->etag.len) != 0
+        || h.vary_len != c->vary.len
+        || ngx_memcmp(h.vary, c->vary.data, c->vary.len) != 0
         || h.crc32 != c->crc32
         || h.header_start != c->header_start
         || h.body_start != c->body_start)



More information about the nginx-devel mailing list