comparison src/http/modules/ngx_http_headers_filter_module.c @ 642:1b80544421e8 NGINX_1_0_11

nginx 1.0.11 *) Change: now double quotes are encoded in an "echo" SSI-command output. Thanks to Zaur Abasmirzoev. *) Feature: the "image_filter_sharpen" directive. *) Bugfix: a segmentation fault might occur in a worker process if SNI was used; the bug had appeared in 1.0.9. *) Bugfix: SIGWINCH signal did not work after first binary upgrade; the bug had appeared in 1.0.9. *) Bugfix: the "If-Modified-Since", "If-Range", etc. client request header lines might be passed to backend while caching; or not passed without caching if caching was enabled in another part of the configuration. *) Bugfix: in the "scgi_param" directive, if complex parameters were used. *) Bugfix: "add_header" and "expires" directives did not work if a request was proxied and response status code was 206. *) Bugfix: in the "expires @time" directive. *) Bugfix: in the ngx_http_flv_module. Thanks to Piotr Sikora. *) Bugfix: in the ngx_http_mp4_module. *) Bugfix: nginx could not be built on FreeBSD 10. *) Bugfix: nginx could not be built on AIX.
author Igor Sysoev <http://sysoev.ru>
date Thu, 15 Dec 2011 00:00:00 +0400
parents 692f4d4d7f10
children ad25218fd14b
comparison
equal deleted inserted replaced
641:e21c9e01ce08 642:1b80544421e8
143 143
144 if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL) 144 if ((conf->expires == NGX_HTTP_EXPIRES_OFF && conf->headers == NULL)
145 || r != r->main 145 || r != r->main
146 || (r->headers_out.status != NGX_HTTP_OK 146 || (r->headers_out.status != NGX_HTTP_OK
147 && r->headers_out.status != NGX_HTTP_NO_CONTENT 147 && r->headers_out.status != NGX_HTTP_NO_CONTENT
148 && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT
148 && r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY 149 && r->headers_out.status != NGX_HTTP_MOVED_PERMANENTLY
149 && r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY 150 && r->headers_out.status != NGX_HTTP_MOVED_TEMPORARILY
150 && r->headers_out.status != NGX_HTTP_NOT_MODIFIED)) 151 && r->headers_out.status != NGX_HTTP_NOT_MODIFIED))
151 { 152 {
152 return ngx_http_next_header_filter(r); 153 return ngx_http_next_header_filter(r);
251 expires->value.data = ngx_pnalloc(r->pool, len); 252 expires->value.data = ngx_pnalloc(r->pool, len);
252 if (expires->value.data == NULL) { 253 if (expires->value.data == NULL) {
253 return NGX_ERROR; 254 return NGX_ERROR;
254 } 255 }
255 256
256 if (conf->expires_time == 0) { 257 if (conf->expires_time == 0 && conf->expires != NGX_HTTP_EXPIRES_DAILY) {
257 ngx_memcpy(expires->value.data, ngx_cached_http_time.data, 258 ngx_memcpy(expires->value.data, ngx_cached_http_time.data,
258 ngx_cached_http_time.len + 1); 259 ngx_cached_http_time.len + 1);
259 ngx_str_set(&cc->value, "max-age=0"); 260 ngx_str_set(&cc->value, "max-age=0");
260 return NGX_OK; 261 return NGX_OK;
261 } 262 }
262 263
263 now = ngx_time(); 264 now = ngx_time();
264 265
265 if (conf->expires == NGX_HTTP_EXPIRES_ACCESS 266 if (conf->expires == NGX_HTTP_EXPIRES_DAILY) {
266 || r->headers_out.last_modified_time == -1) 267 expires_time = ngx_next_time(conf->expires_time);
268 max_age = expires_time - now;
269
270 } else if (conf->expires == NGX_HTTP_EXPIRES_ACCESS
271 || r->headers_out.last_modified_time == -1)
267 { 272 {
268 expires_time = now + conf->expires_time; 273 expires_time = now + conf->expires_time;
269 max_age = conf->expires_time; 274 max_age = conf->expires_time;
270
271 } else if (conf->expires == NGX_HTTP_EXPIRES_DAILY) {
272 expires_time = ngx_next_time(conf->expires_time);
273 max_age = expires_time - now;
274 275
275 } else { 276 } else {
276 expires_time = r->headers_out.last_modified_time + conf->expires_time; 277 expires_time = r->headers_out.last_modified_time + conf->expires_time;
277 max_age = expires_time - now; 278 max_age = expires_time - now;
278 } 279 }