comparison src/http/ngx_http_file_cache.c @ 8127:0875101c08f7 quic

Merged with the default branch.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 01 Oct 2020 12:21:11 +0100
parents 3781de64e747
children dd718d1cef3c
comparison
equal deleted inserted replaced
8105:4983357258d7 8127:0875101c08f7
292 292
293 cln->handler = ngx_http_file_cache_cleanup; 293 cln->handler = ngx_http_file_cache_cleanup;
294 cln->data = c; 294 cln->data = c;
295 } 295 }
296 296
297 c->buffer_size = c->body_start;
298
297 rc = ngx_http_file_cache_exists(cache, c); 299 rc = ngx_http_file_cache_exists(cache, c);
298 300
299 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 301 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
300 "http file cache exists: %i e:%d", rc, c->exists); 302 "http file cache exists: %i e:%d", rc, c->exists);
301 303
850 } 852 }
851 853
852 if (fcn->exists || fcn->uses >= c->min_uses) { 854 if (fcn->exists || fcn->uses >= c->min_uses) {
853 855
854 c->exists = fcn->exists; 856 c->exists = fcn->exists;
855 if (fcn->body_start) { 857 if (fcn->body_start && !c->update_variant) {
856 c->body_start = fcn->body_start; 858 c->body_start = fcn->body_start;
857 } 859 }
858 860
859 rc = NGX_OK; 861 rc = NGX_OK;
860 862
1228 1230
1229 ngx_shmtx_unlock(&cache->shpool->mutex); 1231 ngx_shmtx_unlock(&cache->shpool->mutex);
1230 1232
1231 c->secondary = 1; 1233 c->secondary = 1;
1232 c->file.name.len = 0; 1234 c->file.name.len = 0;
1233 c->body_start = c->buf->end - c->buf->start; 1235 c->body_start = c->buffer_size;
1234 1236
1235 ngx_memcpy(c->key, c->variant, NGX_HTTP_CACHE_KEY_LEN); 1237 ngx_memcpy(c->key, c->variant, NGX_HTTP_CACHE_KEY_LEN);
1236 1238
1237 return ngx_http_file_cache_open(r); 1239 return ngx_http_file_cache_open(r);
1238 } 1240 }
1335 c->node = NULL; 1337 c->node = NULL;
1336 1338
1337 ngx_shmtx_unlock(&cache->shpool->mutex); 1339 ngx_shmtx_unlock(&cache->shpool->mutex);
1338 1340
1339 c->file.name.len = 0; 1341 c->file.name.len = 0;
1342 c->update_variant = 1;
1340 1343
1341 ngx_memcpy(c->key, c->main, NGX_HTTP_CACHE_KEY_LEN); 1344 ngx_memcpy(c->key, c->main, NGX_HTTP_CACHE_KEY_LEN);
1342 1345
1343 if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) { 1346 if (ngx_http_file_cache_exists(cache, c) == NGX_ERROR) {
1344 return NGX_ERROR; 1347 return NGX_ERROR;