Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 7705:3781de64e747
Cache: keep c->body_start when Vary changes (ticket #2029).
If the variant hash doesn't match one we used as a secondary cache key,
we switch back to the original key. In this case, c->body_start was kept
updated from an existing cache node overwriting the new response value.
After file cache update, it led to discrepancy between a cache node and
cache file seen as critical errors "file cache .. has too long header".
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 09 Sep 2020 19:26:27 +0300 |
parents | 847fd35f94de |
children | dd718d1cef3c |
comparison
equal
deleted
inserted
replaced
7704:847fd35f94de | 7705:3781de64e747 |
---|---|
852 } | 852 } |
853 | 853 |
854 if (fcn->exists || fcn->uses >= c->min_uses) { | 854 if (fcn->exists || fcn->uses >= c->min_uses) { |
855 | 855 |
856 c->exists = fcn->exists; | 856 c->exists = fcn->exists; |
857 if (fcn->body_start) { | 857 if (fcn->body_start && !c->update_variant) { |
858 c->body_start = fcn->body_start; | 858 c->body_start = fcn->body_start; |
859 } | 859 } |
860 | 860 |
861 rc = NGX_OK; | 861 rc = NGX_OK; |
862 | 862 |
1337 c->node = NULL; | 1337 c->node = NULL; |
1338 | 1338 |
1339 ngx_shmtx_unlock(&cache->shpool->mutex); | 1339 ngx_shmtx_unlock(&cache->shpool->mutex); |
1340 | 1340 |
1341 c->file.name.len = 0; | 1341 c->file.name.len = 0; |
1342 c->update_variant = 1; | |
1342 | 1343 |
1343 ngx_memcpy(c->key, c->main, NGX_HTTP_CACHE_KEY_LEN); | 1344 ngx_memcpy(c->key, c->main, NGX_HTTP_CACHE_KEY_LEN); |
1344 | 1345 |
1345 if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) { | 1346 if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) { |
1346 return NGX_ERROR; | 1347 return NGX_ERROR; |