Mercurial > hg > nginx-vendor-current
diff src/http/modules/ngx_http_headers_filter_module.c @ 694:88a1b4797f2e NGINX_1_3_10
nginx 1.3.10
*) Change: domain names specified in configuration file are now resolved
to IPv6 addresses as well as IPv4 ones.
*) Change: now if the "include" directive with mask is used on Unix
systems, included files are sorted in alphabetical order.
*) Change: the "add_header" directive adds headers to 201 responses.
*) Feature: the "geo" directive now supports IPv6 addresses in CIDR
notation.
*) Feature: the "flush" and "gzip" parameters of the "access_log"
directive.
*) Feature: variables support in the "auth_basic" directive.
*) Bugfix: nginx could not be built with the ngx_http_perl_module in
some cases.
*) Bugfix: a segmentation fault might occur in a worker process if the
ngx_http_xslt_module was used.
*) Bugfix: nginx could not be built on MacOSX in some cases.
Thanks to Piotr Sikora.
*) Bugfix: the "limit_rate" directive with high rates might result in
truncated responses on 32-bit platforms.
Thanks to Alexey Antropov.
*) Bugfix: a segmentation fault might occur in a worker process if the
"if" directive was used.
Thanks to Piotr Sikora.
*) Bugfix: a "100 Continue" response was issued with "413 Request Entity
Too Large" responses.
*) Bugfix: the "image_filter", "image_filter_jpeg_quality" and
"image_filter_sharpen" directives might be inherited incorrectly.
Thanks to Ian Babrou.
*) Bugfix: "crypt_r() failed" errors might appear if the "auth_basic"
directive was used on Linux.
*) Bugfix: in backup servers handling.
Thanks to Thomas Chen.
*) Bugfix: proxied HEAD requests might return incorrect response if the
"gzip" directive was used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 25 Dec 2012 00:00:00 +0400 |
parents | 597573166f34 |
children |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -74,7 +74,9 @@ static ngx_http_set_header_t ngx_http_s { ngx_string("Cache-Control"), 0, ngx_http_add_cache_control }, - { ngx_string("Last-Modified"), 0, ngx_http_set_last_modified }, + { ngx_string("Last-Modified"), + offsetof(ngx_http_headers_out_t, last_modified), + ngx_http_set_last_modified }, { ngx_string("ETag"), offsetof(ngx_http_headers_out_t, etag), @@ -153,6 +155,7 @@ ngx_http_headers_filter(ngx_http_request if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL) || r != r->main || (r->headers_out.status != NGX_HTTP_OK + && r->headers_out.status != NGX_HTTP_CREATED && r->headers_out.status != NGX_HTTP_NO_CONTENT && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT && r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY @@ -372,27 +375,12 @@ static ngx_int_t ngx_http_set_last_modified(ngx_http_request_t *r, ngx_http_header_val_t *hv, ngx_str_t *value) { - ngx_table_elt_t *h; - - ngx_http_clear_last_modified(r); - - if (value->len == 0) { - return NGX_OK; - } - - r->headers_out.last_modified_time = ngx_http_parse_time(value->data, - value->len); - - h = ngx_list_push(&r->headers_out.headers); - if (h == NULL) { + if (ngx_http_set_response_header(r, hv, value) != NGX_OK) { return NGX_ERROR; } - r->headers_out.last_modified = h; - - h->hash = 1; - h->key = hv->key; - h->value = *value; + r->headers_out.last_modified_time = + (value->len) ? ngx_http_parse_time(value->data, value->len) : -1; return NGX_OK; } @@ -406,22 +394,27 @@ ngx_http_set_response_header(ngx_http_re old = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset); - if (*old) { - (*old)->hash = 0; - *old = NULL; - } + if (value->len == 0) { + if (*old) { + (*old)->hash = 0; + *old = NULL; + } - if (value->len == 0) { return NGX_OK; } - h = ngx_list_push(&r->headers_out.headers); - if (h == NULL) { - return NGX_ERROR; + if (*old) { + h = *old; + + } else { + h = ngx_list_push(&r->headers_out.headers); + if (h == NULL) { + return NGX_ERROR; + } + + *old = h; } - *old = h; - h->hash = 1; h->key = hv->key; h->value = *value;