comparison src/http/ngx_http_upstream.c @ 5869:fd283aa92e04

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>
author Piotr Sikora <piotr@cloudflare.com>
date Wed, 01 Oct 2014 15:48:53 -0700
parents 106a8bfa4f42
children 2aff40b3dea2
comparison
equal deleted inserted replaced
5868:6bbad2e73245 5869:fd283aa92e04
439 #if (NGX_HTTP_CACHE) 439 #if (NGX_HTTP_CACHE)
440 r->cache = NULL; 440 r->cache = NULL;
441 #endif 441 #endif
442 442
443 u->headers_in.content_length_n = -1; 443 u->headers_in.content_length_n = -1;
444 u->headers_in.last_modified_time = -1;
444 445
445 return NGX_OK; 446 return NGX_OK;
446 } 447 }
447 448
448 449
883 u->buffer = *c->buf; 884 u->buffer = *c->buf;
884 u->buffer.pos += c->header_start; 885 u->buffer.pos += c->header_start;
885 886
886 ngx_memzero(&u->headers_in, sizeof(ngx_http_upstream_headers_in_t)); 887 ngx_memzero(&u->headers_in, sizeof(ngx_http_upstream_headers_in_t));
887 u->headers_in.content_length_n = -1; 888 u->headers_in.content_length_n = -1;
889 u->headers_in.last_modified_time = -1;
888 890
889 if (ngx_list_init(&u->headers_in.headers, r->pool, 8, 891 if (ngx_list_init(&u->headers_in.headers, r->pool, 8,
890 sizeof(ngx_table_elt_t)) 892 sizeof(ngx_table_elt_t))
891 != NGX_OK) 893 != NGX_OK)
892 { 894 {
1580 u->keepalive = 0; 1582 u->keepalive = 0;
1581 u->upgrade = 0; 1583 u->upgrade = 0;
1582 1584
1583 ngx_memzero(&u->headers_in, sizeof(ngx_http_upstream_headers_in_t)); 1585 ngx_memzero(&u->headers_in, sizeof(ngx_http_upstream_headers_in_t));
1584 u->headers_in.content_length_n = -1; 1586 u->headers_in.content_length_n = -1;
1587 u->headers_in.last_modified_time = -1;
1585 1588
1586 if (ngx_list_init(&u->headers_in.headers, r->pool, 8, 1589 if (ngx_list_init(&u->headers_in.headers, r->pool, 8,
1587 sizeof(ngx_table_elt_t)) 1590 sizeof(ngx_table_elt_t))
1588 != NGX_OK) 1591 != NGX_OK)
1589 { 1592 {