Mercurial > hg > nginx-vendor-0-5
annotate src/http/modules/ngx_http_not_modified_filter_module.c @ 324:7cf404023f50 NGINX_0_5_32
nginx 0.5.32
*) Change: now nginx tries to set the "worker_priority",
"worker_rlimit_nofile", "worker_rlimit_core", and
"worker_rlimit_sigpending" without super-user privileges.
*) Change: now nginx escapes space and "%" in request to a mail proxy
authentication server.
*) Change: now nginx escapes "%" in $memcached_key variable.
*) Change: the special make target "upgrade1" was defined for online
upgrade of 0.1.x versions.
*) Feature: the "add_header Last-Modified ..." directive changes the
"Last-Modified" response header line.
*) Feature: the mail proxy supports AUTHENTICATE in IMAP mode.
Thanks to Maxim Dounin.
*) Feature: the mail proxy supports STARTTLS in SMTP mode.
Thanks to Maxim Dounin.
*) Bugfix: nginx did not close directory file on HEAD request if
autoindex was used.
Thanks to Arkadiusz Patyk.
*) Bugfix: the "proxy_hide_header" and "fastcgi_hide_header" directives
did not hide response header lines whose name was longer than 32
characters.
Thanks to Manlio Perillo.
*) Bugfix: active connection counter always increased if mail proxy was
used.
*) Bugfix: if backend returned response header only using non-buffered
proxy, then nginx closed backend connection on timeout.
*) Bugfix: nginx did not support several "Connection" request header
lines.
*) Bugfix: a charset set by the "charset" directive was not appended to
the "Content-Type" header set by $r->send_http_header().
*) Bugfix: a segmentation fault might occur in worker process if
/dev/poll method was used.
*) Bugfix: nginx did not work on FreeBSD/sparc64.
*) Bugfix: a segmentation fault occurred in worker process if invalid
address was set in the "auth_http" directive.
*) Bugfix: now nginx uses default listen backlog value 511 on all
platforms except FreeBSD.
Thanks to Jiang Hong.
*) Bugfix: now Solaris sendfilev() is not used to transfer the client
request body to FastCGI-server via the unix domain socket.
*) Bugfix: if the same host without specified port was used as backend
for HTTP and HTTPS, then nginx used only one port - 80 or 443.
*) Bugfix: the "proxy_ignore_client_abort" and
"fastcgi_ignore_client_abort" directives did not work; bug appeared
in 0.5.13.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 24 Sep 2007 00:00:00 +0400 |
parents | 38e7b94d63ac |
children | c60beecc6ab5 |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 #include <ngx_http.h> | |
10 | |
11 | |
12 | |
230 | 13 static ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf); |
0 | 14 |
15 | |
16 static ngx_http_module_t ngx_http_not_modified_filter_module_ctx = { | |
58 | 17 NULL, /* preconfiguration */ |
230 | 18 ngx_http_not_modified_filter_init, /* postconfiguration */ |
0 | 19 |
20 NULL, /* create main configuration */ | |
21 NULL, /* init main configuration */ | |
22 | |
23 NULL, /* create server configuration */ | |
24 NULL, /* merge server configuration */ | |
25 | |
26 NULL, /* create location configuration */ | |
27 NULL /* merge location configuration */ | |
28 }; | |
29 | |
30 | |
31 ngx_module_t ngx_http_not_modified_filter_module = { | |
58 | 32 NGX_MODULE_V1, |
0 | 33 &ngx_http_not_modified_filter_module_ctx, /* module context */ |
34 NULL, /* module directives */ | |
35 NGX_HTTP_MODULE, /* module type */ | |
90 | 36 NULL, /* init master */ |
230 | 37 NULL, /* init module */ |
90 | 38 NULL, /* init process */ |
39 NULL, /* init thread */ | |
40 NULL, /* exit thread */ | |
41 NULL, /* exit process */ | |
42 NULL, /* exit master */ | |
43 NGX_MODULE_V1_PADDING | |
0 | 44 }; |
45 | |
46 | |
47 static ngx_http_output_header_filter_pt ngx_http_next_header_filter; | |
48 | |
49 | |
230 | 50 static |
51 ngx_int_t ngx_http_not_modified_header_filter(ngx_http_request_t *r) | |
0 | 52 { |
53 time_t ims; | |
54 | |
55 if (r->headers_out.status != NGX_HTTP_OK | |
146 | 56 || r != r->main |
0 | 57 || r->headers_in.if_modified_since == NULL |
58 || r->headers_out.last_modified_time == -1) | |
59 { | |
60 return ngx_http_next_header_filter(r); | |
61 } | |
62 | |
63 ims = ngx_http_parse_time(r->headers_in.if_modified_since->value.data, | |
64 r->headers_in.if_modified_since->value.len); | |
126 | 65 |
0 | 66 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 | |
69 /* | |
70 * I think that the equality of the dates is correcter | |
71 */ | |
72 | |
73 if (ims != NGX_ERROR && ims == r->headers_out.last_modified_time) { | |
74 r->headers_out.status = NGX_HTTP_NOT_MODIFIED; | |
58 | 75 r->headers_out.content_type.len = 0; |
126 | 76 ngx_http_clear_content_length(r); |
77 ngx_http_clear_accept_ranges(r); | |
0 | 78 } |
79 | |
80 return ngx_http_next_header_filter(r); | |
81 } | |
82 | |
83 | |
230 | 84 static |
85 ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf) | |
0 | 86 { |
87 ngx_http_next_header_filter = ngx_http_top_header_filter; | |
88 ngx_http_top_header_filter = ngx_http_not_modified_header_filter; | |
89 | |
90 return NGX_OK; | |
91 } |