[nginx] Upstream: fix $upstream_cache_last_modified variable.

Maxim Dounin mdounin at mdounin.ru
Wed Oct 8 13:41:40 UTC 2014


details:   http://hg.nginx.org/nginx/rev/fd283aa92e04
branches:  
changeset: 5869:fd283aa92e04
user:      Piotr Sikora <piotr at cloudflare.com>
date:      Wed Oct 01 15:48:53 2014 -0700
description:
Upstream: fix $upstream_cache_last_modified variable.

Due to the u->headers_in.last_modified_time not being correctly initialized,
this variable was evaluated to "Thu, 01 Jan 1970 00:00:00 GMT" for responses
cached without the "Last-Modified" header which resulted in subsequent proxy
requests being sent with "If-Modified-Since: Thu, 01 Jan 1970 00:00:00 GMT"
header.

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

diffstat:

 src/http/ngx_http_upstream.c |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (27 lines):

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -441,6 +441,7 @@ ngx_http_upstream_create(ngx_http_reques
 #endif
 
     u->headers_in.content_length_n = -1;
+    u->headers_in.last_modified_time = -1;
 
     return NGX_OK;
 }
@@ -885,6 +886,7 @@ ngx_http_upstream_cache_send(ngx_http_re
 
     ngx_memzero(&u->headers_in, sizeof(ngx_http_upstream_headers_in_t));
     u->headers_in.content_length_n = -1;
+    u->headers_in.last_modified_time = -1;
 
     if (ngx_list_init(&u->headers_in.headers, r->pool, 8,
                       sizeof(ngx_table_elt_t))
@@ -1582,6 +1584,7 @@ ngx_http_upstream_reinit(ngx_http_reques
 
     ngx_memzero(&u->headers_in, sizeof(ngx_http_upstream_headers_in_t));
     u->headers_in.content_length_n = -1;
+    u->headers_in.last_modified_time = -1;
 
     if (ngx_list_init(&u->headers_in.headers, r->pool, 8,
                       sizeof(ngx_table_elt_t))



More information about the nginx-devel mailing list