annotate src/http/modules/ngx_http_not_modified_filter_module.c @ 4247:b79dbadb3d5e stable-1.0

Merging r4147, r4148, r4149, r4150, r4207: Fixes of combination of error_page and return directives: *) Fix for incorrect 201 replies from dav module. Replies with 201 code contain body, and we should clearly indicate it's empty if it's empty. Before 0.8.32 chunked was explicitly disabled for 201 replies and as a result empty body was indicated by connection close (not perfect, but worked). Since 0.8.32 chunked is enabled, and this causes incorrect responses from dav module when HTTP/1.1 is used: with "Transfer-Encoding: chunked" but no chunks at all. Fix is to actually return empty body in special response handler instead of abusing r->header_only flag. See here for initial report: http://mailman.nginx.org/pipermail/nginx-ru/2010-October/037535.html *) Fix for double content when return is used in error_page handler. Test case: location / { error_page 405 /nope; return 405; } location /nope { return 200; } This is expected to return 405 with empty body, but in 0.8.42+ will return builtin 405 error page as well (though not counted in Content-Length, thus breaking protocol). Fix is to use status provided by rewrite script execution in case it's less than NGX_HTTP_BAD_REQUEST even if r->error_status set. This check is in line with one in ngx_http_script_return_code(). Note that this patch also changes behaviour for "return 302 ..." and "rewrite ... redirect" used as error handler. E.g. location / { error_page 405 /redirect; return 405; } location /redirect { rewrite ^ http://example.com/; } will actually return redirect to "http://example.com/" instead of builtin 405 error page with meaningless Location header. This looks like correct change and it's in line with what happens on e.g. directory redirects in error handlers. *) Fix for "return 202" not discarding body. Big POST (not fully preread) to a location / { return 202; } resulted in incorrect behaviour due to "return" code path not calling ngx_http_discard_request_body(). The same applies to all "return" used with 2xx/3xx codes except 201 and 204, and to all "return ... text" uses. Fix is to add ngx_http_discard_request_body() call to ngx_http_send_response() function where it looks appropriate. Discard body call from emtpy gif module removed as it's now redundant. Reported by Pyry Hakulinen, see http://mailman.nginx.org/pipermail/nginx/2011-August/028503.html *) Incorrect special case for "return 204" removed. The special case in question leads to replies without body in configuration like location / { error_page 404 /zero; return 404; } location /zero { return 204; } while replies with empty body are expected per protocol specs. Correct one will look like if (status == NGX_HTTP_NO_CONTENT) { rc = ngx_http_send_header(r); if (rc == NGX_ERROR || r->header_only) { return rc; } return ngx_http_send_special(r, NGX_HTTP_LAST); } though it looks like it's better to drop this special case at all. *) Clear old Location header (if any) while adding a new one. This prevents incorrect behaviour when another redirect is issued within error_page 302 handler.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 01 Nov 2011 13:45:33 +0000
parents 80cc7c8bb845
children d620f497c50f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
1
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
2 /*
444
42d11f017717 nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents: 441
diff changeset
3 * Copyright (C) Igor Sysoev
441
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
4 */
da8c5707af39 nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents: 356
diff changeset
5
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
6
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7 #include <ngx_config.h>
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 #include <ngx_core.h>
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #include <ngx_http.h>
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
12 static ngx_int_t ngx_http_test_precondition(ngx_http_request_t *r);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
13 static ngx_int_t ngx_http_test_not_modified(ngx_http_request_t *r);
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 597
diff changeset
14 static ngx_int_t ngx_http_not_modified_filter_init(ngx_conf_t *cf);
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
15
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
16
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17 static ngx_http_module_t ngx_http_not_modified_filter_module_ctx = {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
18 NULL, /* preconfiguration */
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 597
diff changeset
19 ngx_http_not_modified_filter_init, /* postconfiguration */
177
4db54fdbcbe7 nginx-0.0.1-2003-11-10-20:17:31 import
Igor Sysoev <igor@sysoev.ru>
parents: 155
diff changeset
20
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
21 NULL, /* create main configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 NULL, /* init main configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24 NULL, /* create server configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25 NULL, /* merge server configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27 NULL, /* create location configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28 NULL /* merge location configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 };
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
30
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
31
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
32 ngx_module_t ngx_http_not_modified_filter_module = {
509
9b8c906f6e63 nginx-0.1.29-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 501
diff changeset
33 NGX_MODULE_V1,
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
34 &ngx_http_not_modified_filter_module_ctx, /* module context */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 NULL, /* module directives */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
36 NGX_HTTP_MODULE, /* module type */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
37 NULL, /* init master */
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 597
diff changeset
38 NULL, /* init module */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
39 NULL, /* init process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
40 NULL, /* init thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
41 NULL, /* exit thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
42 NULL, /* exit process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
43 NULL, /* exit master */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
44 NGX_MODULE_V1_PADDING
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
45 };
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
46
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
47
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
48 static ngx_http_output_header_filter_pt ngx_http_next_header_filter;
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
49
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
50
2702
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
51 static ngx_int_t
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
52 ngx_http_not_modified_header_filter(ngx_http_request_t *r)
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
53 {
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
54 if (r->headers_out.status != NGX_HTTP_OK
597
9262f520ce21 nginx-0.3.20-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 577
diff changeset
55 || r != r->main
142
cb77c084acdb nginx-0.0.1-2003-10-09-11:00:45 import
Igor Sysoev <igor@sysoev.ru>
parents: 136
diff changeset
56 || r->headers_out.last_modified_time == -1)
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
57 {
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
58 return ngx_http_next_header_filter(r);
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
59 }
3854
80cc7c8bb845 style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3814
diff changeset
60
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
61 if (r->headers_in.if_unmodified_since) {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
62 return ngx_http_test_precondition(r);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
63 }
3854
80cc7c8bb845 style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3814
diff changeset
64
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
65 if (r->headers_in.if_modified_since) {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
66 return ngx_http_test_not_modified(r);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
67 }
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
68
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
69 return ngx_http_next_header_filter(r);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
70 }
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
71
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
72
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
73 static ngx_int_t
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
74 ngx_http_test_precondition(ngx_http_request_t *r)
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
75 {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
76 time_t iums;
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
77
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
78 iums = ngx_http_parse_time(r->headers_in.if_unmodified_since->value.data,
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
79 r->headers_in.if_unmodified_since->value.len);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
80
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
81 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
82 "http iums:%d lm:%d", iums, r->headers_out.last_modified_time);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
83
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
84 if (iums >= r->headers_out.last_modified_time) {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
85 return ngx_http_next_header_filter(r);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
86 }
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
87
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
88 return ngx_http_filter_finalize_request(r, NULL,
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
89 NGX_HTTP_PRECONDITION_FAILED);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
90 }
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
91
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
92
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
93 static ngx_int_t
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
94 ngx_http_test_not_modified(ngx_http_request_t *r)
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
95 {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
96 time_t ims;
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
97 ngx_http_core_loc_conf_t *clcf;
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
98
2496
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
99 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
100
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
101 if (clcf->if_modified_since == NGX_HTTP_IMS_OFF) {
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
102 return ngx_http_next_header_filter(r);
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
103 }
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
104
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
105 ims = ngx_http_parse_time(r->headers_in.if_modified_since->value.data,
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
106 r->headers_in.if_modified_since->value.len);
577
4d9ea73a627a nginx-0.3.10-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 553
diff changeset
107
257
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 195
diff changeset
108 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 195
diff changeset
109 "http ims:%d lm:%d", ims, r->headers_out.last_modified_time);
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
110
2361
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
111 if (ims != r->headers_out.last_modified_time) {
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
112
2496
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
113 if (clcf->if_modified_since == NGX_HTTP_IMS_EXACT
2361
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
114 || ims < r->headers_out.last_modified_time)
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
115 {
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
116 return ngx_http_next_header_filter(r);
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
117 }
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
118 }
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
119
2361
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
120 r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
2592
3a8a53c0c42f a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents: 2496
diff changeset
121 r->headers_out.status_line.len = 0;
2361
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
122 r->headers_out.content_type.len = 0;
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
123 ngx_http_clear_content_length(r);
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
124 ngx_http_clear_accept_ranges(r);
c59485781f0a if_modified_since
Igor Sysoev <igor@sysoev.ru>
parents: 1631
diff changeset
125
3308
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
126 if (r->headers_out.content_encoding) {
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
127 r->headers_out.content_encoding->hash = 0;
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
128 r->headers_out.content_encoding = NULL;
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
129 }
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
130
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
131 return ngx_http_next_header_filter(r);
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
132 }
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
133
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
134
2702
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
135 static ngx_int_t
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
136 ngx_http_not_modified_filter_init(ngx_conf_t *cf)
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
137 {
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
138 ngx_http_next_header_filter = ngx_http_top_header_filter;
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
139 ngx_http_top_header_filter = ngx_http_not_modified_header_filter;
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
140
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
141 return NGX_OK;
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
142 }