summaryrefslogtreecommitdiffhomepage
path: root/src/http/ngx_http_file_cache.c
diff options
context:
space:
mode:
authorPiotr Sikora <piotr@cloudflare.com>2014-11-26 18:35:37 -0800
committerPiotr Sikora <piotr@cloudflare.com>2014-11-26 18:35:37 -0800
commit1ea64b3f8ffac75f27051a3ce1cdf584393ed2f1 (patch)
tree606ba25d6362ec3adc5f45c62f0f0a4a2faf0fd2 /src/http/ngx_http_file_cache.c
parentcf5013dd3fb2531ca465cae7481ddc4cc16e56c5 (diff)
downloadnginx-1ea64b3f8ffac75f27051a3ce1cdf584393ed2f1.tar.gz
nginx-1ea64b3f8ffac75f27051a3ce1cdf584393ed2f1.tar.bz2
Cache: send conditional requests only for cached 200/206 responses.
RFC7232 says: The 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a 200 (OK) response if it were not for the fact that the condition evaluated to false. which means that there is no reason to send requests with "If-None-Match" and/or "If-Modified-Since" headers for responses cached with other status codes. Also, sending conditional requests for responses cached with other status codes could result in a strange behavior, e.g. upstream server returning 304 Not Modified for cached 404 Not Found responses, etc. Signed-off-by: Piotr Sikora <piotr@cloudflare.com>
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
-rw-r--r--src/http/ngx_http_file_cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
index c3f4f05d2..ee4bfc06d 100644
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -177,6 +177,8 @@ ngx_http_file_cache_new(ngx_http_request_t *r)
c->file.log = r->connection->log;
c->file.fd = NGX_INVALID_FILE;
+ c->last_modified = -1;
+
return NGX_OK;
}