Welcome! Log In Create A New Profile

Advanced

[PATCH] Upstream: fix $upstream_cache_last_modified variable

Piotr Sikora
October 01, 2014 08:22PM
# HG changeset patch
# User Piotr Sikora <piotr@cloudflare.com>
# Date 1412203733 25200
# Wed Oct 01 15:48:53 2014 -0700
# Node ID dbf6364ab44fcc6b5d1fbbe64c162135b18e9209
# Parent a215d9021f137b9e2d4f69c37c7f992a2bef12c6
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@cloudflare.com>

diff -r a215d9021f13 -r dbf6364ab44f src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Tue Sep 30 17:20:33 2014 +0400
+++ b/src/http/ngx_http_upstream.c Wed Oct 01 15:48:53 2014 -0700
@@ -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))

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Upstream: fix $upstream_cache_last_modified variable

Piotr Sikora 577 October 01, 2014 08:22PM

Re: [PATCH] Upstream: fix $upstream_cache_last_modified variable

Maxim Dounin 317 October 08, 2014 09:44AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready