Mercurial > hg > nginx-ranges
comparison src/http/modules/ngx_http_not_modified_filter_module.c @ 433:9da1d9d94d18 NGINX_0_7_24
nginx 0.7.24
*) Feature: the "if_modified_since" directive.
*) Bugfix: nginx did not process a FastCGI server response, if the
server send too many messages to stderr before response.
*) Bugfix: the "$cookie_..." variables did not work in the SSI and the
perl module.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 01 Dec 2008 00:00:00 +0300 |
parents | 05693816539c |
children | 33394d1255b0 |
comparison
equal
deleted
inserted
replaced
432:ca440bb56eca | 433:9da1d9d94d18 |
---|---|
48 | 48 |
49 | 49 |
50 static | 50 static |
51 ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r) | 51 ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r) |
52 { | 52 { |
53 time_t ims; | 53 time_t ims; |
54 ngx_http_core_loc_conf_t *clcf; | |
54 | 55 |
55 if (r->headers_out.status != NGX_HTTP_OK | 56 if (r->headers_out.status != NGX_HTTP_OK |
56 || r != r->main | 57 || r != r->main |
57 || r->headers_in.if_modified_since == NULL | 58 || r->headers_in.if_modified_since == NULL |
58 || r->headers_out.last_modified_time == -1) | 59 || r->headers_out.last_modified_time == -1) |
64 r->headers_in.if_modified_since->value.len); | 65 r->headers_in.if_modified_since->value.len); |
65 | 66 |
66 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 67 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
67 "http ims:%d lm:%d", ims, r->headers_out.last_modified_time); | 68 "http ims:%d lm:%d", ims, r->headers_out.last_modified_time); |
68 | 69 |
69 /* | 70 if (ims != r->headers_out.last_modified_time) { |
70 * I think that the equality of the dates is correcter | |
71 */ | |
72 | 71 |
73 if (ims == r->headers_out.last_modified_time) { | 72 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
74 r->headers_out.status = NGX_HTTP_NOT_MODIFIED; | 73 |
75 r->headers_out.content_type.len = 0; | 74 if (clcf->if_modified_since == 0 |
76 ngx_http_clear_content_length(r); | 75 || ims < r->headers_out.last_modified_time) |
77 ngx_http_clear_accept_ranges(r); | 76 { |
77 return ngx_http_next_header_filter(r); | |
78 } | |
78 } | 79 } |
80 | |
81 r->headers_out.status = NGX_HTTP_NOT_MODIFIED; | |
82 r->headers_out.content_type.len = 0; | |
83 ngx_http_clear_content_length(r); | |
84 ngx_http_clear_accept_ranges(r); | |
79 | 85 |
80 return ngx_http_next_header_filter(r); | 86 return ngx_http_next_header_filter(r); |
81 } | 87 } |
82 | 88 |
83 | 89 |