Mercurial > hg > nginx-ranges
diff src/http/modules/ngx_http_headers_filter_module.c @ 86:962c43960644 NGINX_0_1_43
nginx 0.1.43
*) Feature: the listen(2) backlog in the "listen" directive can be
changed using the -HUP signal.
*) Feature: the geo2nginx.pl script was added to contrib.
*) Change: the FastCGI parameters with the empty values now are passed
to a server.
*) Bugfix: the segmentation fault occurred or the worker process may
got caught in an endless loop if the proxied or FastCGI server sent
the "Cache-Control" header line and the "expires" directive was
used; in the proxied mode the bug appeared in 0.1.29.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 30 Aug 2005 00:00:00 +0400 |
parents | b55cbf18157e |
children | 71c46860eb55 |
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 @@ -73,7 +73,7 @@ ngx_http_headers_filter(ngx_http_request { size_t len; ngx_uint_t i; - ngx_table_elt_t *expires, *cc; + ngx_table_elt_t *expires, *cc, **ccp; ngx_http_headers_conf_t *conf; if (r->headers_out.status != NGX_HTTP_OK || r->main) { @@ -103,9 +103,20 @@ ngx_http_headers_filter(ngx_http_request len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT"); expires->value.len = len - 1; - cc = r->headers_out.cache_control.elts; + ccp = r->headers_out.cache_control.elts; + + if (ccp == NULL) { - if (cc == NULL) { + if (ngx_array_init(&r->headers_out.cache_control, r->pool, + 1, sizeof(ngx_table_elt_t *)) != NGX_OK) + { + return NGX_ERROR; + } + + ccp = ngx_array_push(&r->headers_out.cache_control); + if (ccp == NULL) { + return NGX_ERROR; + } cc = ngx_list_push(&r->headers_out.headers); if (cc == NULL) { @@ -116,10 +127,14 @@ ngx_http_headers_filter(ngx_http_request cc->key.len = sizeof("Cache-Control") - 1; cc->key.data = (u_char *) "Cache-Control"; + *ccp = cc; + } else { for (i = 1; i < r->headers_out.cache_control.nelts; i++) { - cc[i].hash = 0; + ccp[i]->hash = 0; } + + cc = ccp[0]; } if (conf->expires == NGX_HTTP_EXPIRES_EPOCH) {