annotate src/http/modules/ngx_http_not_modified_filter_module.c @ 4743:84cc73e01aa8

Not modified filter: tests separated from actions. This makes code more extendable. The only functional change is when If-Modified-Since and If-Unmodified-Since are specified together, the case which is explicitly left undefined by RFC 2616. The new behaviour is to respect them both, which seems better.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 07 Jul 2012 21:18:30 +0000
parents d620f497c50f
children 5b93a9ac60ed
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
4412
d620f497c50f Copyright updated.
Maxim Konovalov <maxim@nginx.com>
parents: 3854
diff changeset
4 * Copyright (C) Nginx, Inc.
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
5 */
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
6
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
7
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
8 #include <ngx_config.h>
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
9 #include <ngx_core.h>
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
10 #include <ngx_http.h>
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
11
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
12
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
13 static ngx_uint_t ngx_http_test_if_unmodified(ngx_http_request_t *r);
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
14 static ngx_uint_t ngx_http_test_if_modified(ngx_http_request_t *r);
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 597
diff changeset
15 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
16
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
17
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
18 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
19 NULL, /* preconfiguration */
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 597
diff changeset
20 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
21
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
22 NULL, /* create main configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
23 NULL, /* init main configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
24
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
25 NULL, /* create server configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
26 NULL, /* merge server configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
27
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
28 NULL, /* create location configuration */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
29 NULL /* merge location configuration */
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
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
33 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
34 NGX_MODULE_V1,
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
35 &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
36 NULL, /* module directives */
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
37 NGX_HTTP_MODULE, /* module type */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
38 NULL, /* init master */
681
7e24168b0853 nginx-0.4.0-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 597
diff changeset
39 NULL, /* init module */
541
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
40 NULL, /* init process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
41 NULL, /* init thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
42 NULL, /* exit thread */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
43 NULL, /* exit process */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
44 NULL, /* exit master */
b09ee85d0ac8 nginx-0.1.45-RELEASE import
Igor Sysoev <igor@sysoev.ru>
parents: 509
diff changeset
45 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
46 };
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
47
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
48
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
49 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
50
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
51
2702
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
52 static ngx_int_t
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
53 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
54 {
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
55 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
56 || 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
57 || 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
58 {
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
59 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
60 }
3854
80cc7c8bb845 style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3814
diff changeset
61
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
62 if (r->headers_in.if_unmodified_since
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
63 && !ngx_http_test_if_unmodified(r))
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
64 {
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
65 return ngx_http_filter_finalize_request(r, NULL,
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
66 NGX_HTTP_PRECONDITION_FAILED);
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
67 }
3854
80cc7c8bb845 style fix: remove trailing spaces
Igor Sysoev <igor@sysoev.ru>
parents: 3814
diff changeset
68
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
69 if (r->headers_in.if_modified_since
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
70 && !ngx_http_test_if_modified(r))
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
71 {
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
72 /* not modified */
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
73
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
74 r->headers_out.status = NGX_HTTP_NOT_MODIFIED;
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
75 r->headers_out.status_line.len = 0;
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
76 r->headers_out.content_type.len = 0;
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
77 ngx_http_clear_content_length(r);
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
78 ngx_http_clear_accept_ranges(r);
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
79
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
80 if (r->headers_out.content_encoding) {
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
81 r->headers_out.content_encoding->hash = 0;
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
82 r->headers_out.content_encoding = NULL;
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
83 }
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
84
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
85 return ngx_http_next_header_filter(r);
3814
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_next_header_filter(r);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
89 }
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
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
92 static ngx_uint_t
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
93 ngx_http_test_if_unmodified(ngx_http_request_t *r)
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
94 {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
95 time_t iums;
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
96
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
97 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
98 r->headers_in.if_unmodified_since->value.len);
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
99
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
100 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
101 "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
102
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
103 if (iums >= r->headers_out.last_modified_time) {
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
104 return 1;
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
105 }
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
106
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
107 return 0;
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
108 }
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
109
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
110
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
111 static ngx_uint_t
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
112 ngx_http_test_if_modified(ngx_http_request_t *r)
3814
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
113 {
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
114 time_t ims;
e6e453203bae "If-Unmodified-Since" support
Igor Sysoev <igor@sysoev.ru>
parents: 3308
diff changeset
115 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
116
2496
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
117 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
118
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
119 if (clcf->if_modified_since == NGX_HTTP_IMS_OFF) {
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
120 return 1;
2496
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
121 }
9081bbdccda1 if_modified_since off
Igor Sysoev <igor@sysoev.ru>
parents: 2361
diff changeset
122
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
123 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
124 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
125
257
70e1c7d2b83d nginx-0.0.2-2004-02-11-20:08:49 import
Igor Sysoev <igor@sysoev.ru>
parents: 195
diff changeset
126 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
127 "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
128
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
129 if (ims == r->headers_out.last_modified_time) {
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
130 return 0;
135
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
131 }
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
132
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
133 if (clcf->if_modified_since == NGX_HTTP_IMS_EXACT
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
134 || ims < r->headers_out.last_modified_time)
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
135 {
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
136 return 1;
3308
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
137 }
793ae4dd91e9 remove "Content-Encoding: gzip" in 304 response
Igor Sysoev <igor@sysoev.ru>
parents: 2702
diff changeset
138
4743
84cc73e01aa8 Not modified filter: tests separated from actions.
Maxim Dounin <mdounin@mdounin.ru>
parents: 4412
diff changeset
139 return 0;
135
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
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
142
2702
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
143 static ngx_int_t
eace65d6092b style fix
Igor Sysoev <igor@sysoev.ru>
parents: 2592
diff changeset
144 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
145 {
155
46eb23d9471d nginx-0.0.1-2003-10-22-20:38:26 import
Igor Sysoev <igor@sysoev.ru>
parents: 153
diff changeset
146 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
147 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
148
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
149 return NGX_OK;
e29909bd9b8a nginx-0.0.1-2003-09-28-23:29:06 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff changeset
150 }