Mercurial > hg > nginx-quic
annotate src/http/modules/ngx_http_scgi_module.c @ 5959:f7584d7c0ccb
Cache: update variant while setting header.
Some parts of code related to handling variants of a resource moved into
a separate function that is called earlier. This allows to use cache file
name as a prefix for temporary file in the following patch.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Fri, 26 Dec 2014 16:22:56 +0300 |
parents | 610832763648 |
children | b6eb6ec4fbd9 |
rev | line source |
---|---|
3637 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4412 | 4 * Copyright (C) Nginx, Inc. |
3637 | 5 * Copyright (C) Manlio Perillo (manlio.perillo@gmail.com) |
6 */ | |
7 | |
8 | |
9 #include <ngx_config.h> | |
10 #include <ngx_core.h> | |
11 #include <ngx_http.h> | |
12 | |
13 | |
14 typedef struct { | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
15 ngx_array_t caches; /* ngx_http_file_cache_t * */ |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
16 } ngx_http_scgi_main_conf_t; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
17 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
18 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
19 typedef struct { |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
20 ngx_array_t *flushes; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
21 ngx_array_t *lengths; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
22 ngx_array_t *values; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
23 ngx_uint_t number; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
24 ngx_hash_t hash; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
25 } ngx_http_scgi_params_t; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
26 |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
27 |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
28 typedef struct { |
3637 | 29 ngx_http_upstream_conf_t upstream; |
30 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
31 ngx_http_scgi_params_t params; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
32 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
33 ngx_http_scgi_params_t params_cache; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
34 #endif |
3637 | 35 ngx_array_t *params_source; |
36 | |
37 ngx_array_t *scgi_lengths; | |
38 ngx_array_t *scgi_values; | |
39 | |
40 #if (NGX_HTTP_CACHE) | |
41 ngx_http_complex_value_t cache_key; | |
42 #endif | |
43 } ngx_http_scgi_loc_conf_t; | |
44 | |
45 | |
46 static ngx_int_t ngx_http_scgi_eval(ngx_http_request_t *r, | |
47 ngx_http_scgi_loc_conf_t *scf); | |
48 static ngx_int_t ngx_http_scgi_create_request(ngx_http_request_t *r); | |
49 static ngx_int_t ngx_http_scgi_reinit_request(ngx_http_request_t *r); | |
50 static ngx_int_t ngx_http_scgi_process_status_line(ngx_http_request_t *r); | |
51 static ngx_int_t ngx_http_scgi_process_header(ngx_http_request_t *r); | |
52 static void ngx_http_scgi_abort_request(ngx_http_request_t *r); | |
53 static void ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc); | |
54 | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
55 static void *ngx_http_scgi_create_main_conf(ngx_conf_t *cf); |
3637 | 56 static void *ngx_http_scgi_create_loc_conf(ngx_conf_t *cf); |
57 static char *ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, | |
58 void *child); | |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
59 static ngx_int_t ngx_http_scgi_init_params(ngx_conf_t *cf, |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
60 ngx_http_scgi_loc_conf_t *conf, ngx_http_scgi_params_t *params, |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
61 ngx_keyval_t *default_params); |
3637 | 62 |
63 static char *ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | |
64 static char *ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd, | |
65 void *conf); | |
66 | |
67 #if (NGX_HTTP_CACHE) | |
68 static ngx_int_t ngx_http_scgi_create_key(ngx_http_request_t *r); | |
69 static char *ngx_http_scgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, | |
70 void *conf); | |
71 static char *ngx_http_scgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, | |
72 void *conf); | |
73 #endif | |
74 | |
75 | |
76 static ngx_conf_bitmask_t ngx_http_scgi_next_upstream_masks[] = { | |
77 { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, | |
78 { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, | |
79 { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, | |
80 { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, | |
81 { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, | |
5231
05c53652e7b4
Upstream: http_403 support in proxy_next_upstream (and friends).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5080
diff
changeset
|
82 { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 }, |
3637 | 83 { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 }, |
84 { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING }, | |
85 { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF }, | |
86 { ngx_null_string, 0 } | |
87 }; | |
88 | |
89 | |
90 ngx_module_t ngx_http_scgi_module; | |
91 | |
92 | |
93 static ngx_command_t ngx_http_scgi_commands[] = { | |
94 | |
95 { ngx_string("scgi_pass"), | |
96 NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, | |
97 ngx_http_scgi_pass, | |
98 NGX_HTTP_LOC_CONF_OFFSET, | |
99 0, | |
100 NULL }, | |
101 | |
102 { ngx_string("scgi_store"), | |
103 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
104 ngx_http_scgi_store, | |
105 NGX_HTTP_LOC_CONF_OFFSET, | |
106 0, | |
107 NULL }, | |
108 | |
109 { ngx_string("scgi_store_access"), | |
110 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123, | |
111 ngx_conf_set_access_slot, | |
112 NGX_HTTP_LOC_CONF_OFFSET, | |
113 offsetof(ngx_http_scgi_loc_conf_t, upstream.store_access), | |
114 NULL }, | |
115 | |
4157
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
116 { ngx_string("scgi_buffering"), |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
117 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
118 ngx_conf_set_flag_slot, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
119 NGX_HTTP_LOC_CONF_OFFSET, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
120 offsetof(ngx_http_scgi_loc_conf_t, upstream.buffering), |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
121 NULL }, |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
122 |
3637 | 123 { ngx_string("scgi_ignore_client_abort"), |
124 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
125 ngx_conf_set_flag_slot, | |
126 NGX_HTTP_LOC_CONF_OFFSET, | |
127 offsetof(ngx_http_scgi_loc_conf_t, upstream.ignore_client_abort), | |
128 NULL }, | |
129 | |
130 { ngx_string("scgi_bind"), | |
131 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
132 ngx_http_upstream_bind_set_slot, | |
133 NGX_HTTP_LOC_CONF_OFFSET, | |
134 offsetof(ngx_http_scgi_loc_conf_t, upstream.local), | |
135 NULL }, | |
136 | |
137 { ngx_string("scgi_connect_timeout"), | |
138 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
139 ngx_conf_set_msec_slot, | |
140 NGX_HTTP_LOC_CONF_OFFSET, | |
141 offsetof(ngx_http_scgi_loc_conf_t, upstream.connect_timeout), | |
142 NULL }, | |
143 | |
144 { ngx_string("scgi_send_timeout"), | |
145 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
146 ngx_conf_set_msec_slot, | |
147 NGX_HTTP_LOC_CONF_OFFSET, | |
148 offsetof(ngx_http_scgi_loc_conf_t, upstream.send_timeout), | |
149 NULL }, | |
150 | |
151 { ngx_string("scgi_buffer_size"), | |
152 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
153 ngx_conf_set_size_slot, | |
154 NGX_HTTP_LOC_CONF_OFFSET, | |
155 offsetof(ngx_http_scgi_loc_conf_t, upstream.buffer_size), | |
156 NULL }, | |
157 | |
158 { ngx_string("scgi_pass_request_headers"), | |
159 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
160 ngx_conf_set_flag_slot, | |
161 NGX_HTTP_LOC_CONF_OFFSET, | |
162 offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_request_headers), | |
163 NULL }, | |
164 | |
165 { ngx_string("scgi_pass_request_body"), | |
166 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
167 ngx_conf_set_flag_slot, | |
168 NGX_HTTP_LOC_CONF_OFFSET, | |
169 offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_request_body), | |
170 NULL }, | |
171 | |
172 { ngx_string("scgi_intercept_errors"), | |
173 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
174 ngx_conf_set_flag_slot, | |
175 NGX_HTTP_LOC_CONF_OFFSET, | |
176 offsetof(ngx_http_scgi_loc_conf_t, upstream.intercept_errors), | |
177 NULL }, | |
178 | |
179 { ngx_string("scgi_read_timeout"), | |
180 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
181 ngx_conf_set_msec_slot, | |
182 NGX_HTTP_LOC_CONF_OFFSET, | |
183 offsetof(ngx_http_scgi_loc_conf_t, upstream.read_timeout), | |
184 NULL }, | |
185 | |
186 { ngx_string("scgi_buffers"), | |
187 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, | |
188 ngx_conf_set_bufs_slot, | |
189 NGX_HTTP_LOC_CONF_OFFSET, | |
190 offsetof(ngx_http_scgi_loc_conf_t, upstream.bufs), | |
191 NULL }, | |
192 | |
193 { ngx_string("scgi_busy_buffers_size"), | |
194 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
195 ngx_conf_set_size_slot, | |
196 NGX_HTTP_LOC_CONF_OFFSET, | |
197 offsetof(ngx_http_scgi_loc_conf_t, upstream.busy_buffers_size_conf), | |
198 NULL }, | |
199 | |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
200 { ngx_string("scgi_force_ranges"), |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
201 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
202 ngx_conf_set_flag_slot, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
203 NGX_HTTP_LOC_CONF_OFFSET, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
204 offsetof(ngx_http_scgi_loc_conf_t, upstream.force_ranges), |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
205 NULL }, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
206 |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
207 { ngx_string("scgi_limit_rate"), |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
208 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
209 ngx_conf_set_size_slot, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
210 NGX_HTTP_LOC_CONF_OFFSET, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
211 offsetof(ngx_http_scgi_loc_conf_t, upstream.limit_rate), |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
212 NULL }, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
213 |
3637 | 214 #if (NGX_HTTP_CACHE) |
215 | |
216 { ngx_string("scgi_cache"), | |
3729 | 217 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3637 | 218 ngx_http_scgi_cache, |
219 NGX_HTTP_LOC_CONF_OFFSET, | |
220 0, | |
221 NULL }, | |
222 | |
223 { ngx_string("scgi_cache_key"), | |
3729 | 224 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3637 | 225 ngx_http_scgi_cache_key, |
226 NGX_HTTP_LOC_CONF_OFFSET, | |
227 0, | |
228 NULL }, | |
229 | |
230 { ngx_string("scgi_cache_path"), | |
231 NGX_HTTP_MAIN_CONF|NGX_CONF_2MORE, | |
232 ngx_http_file_cache_set_slot, | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
233 NGX_HTTP_MAIN_CONF_OFFSET, |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
234 offsetof(ngx_http_scgi_main_conf_t, caches), |
3637 | 235 &ngx_http_scgi_module }, |
236 | |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
237 { ngx_string("scgi_cache_bypass"), |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
238 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
239 ngx_http_set_predicate_slot, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
240 NGX_HTTP_LOC_CONF_OFFSET, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
241 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_bypass), |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
242 NULL }, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
243 |
3637 | 244 { ngx_string("scgi_no_cache"), |
245 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
3692
045ea40cbfe8
use ngx_http_test_predicates(), ngx_http_set_predicate_slot()
Igor Sysoev <igor@sysoev.ru>
parents:
3670
diff
changeset
|
246 ngx_http_set_predicate_slot, |
3637 | 247 NGX_HTTP_LOC_CONF_OFFSET, |
248 offsetof(ngx_http_scgi_loc_conf_t, upstream.no_cache), | |
249 NULL }, | |
250 | |
251 { ngx_string("scgi_cache_valid"), | |
252 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
253 ngx_http_file_cache_valid_set_slot, | |
254 NGX_HTTP_LOC_CONF_OFFSET, | |
255 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_valid), | |
256 NULL }, | |
257 | |
258 { ngx_string("scgi_cache_min_uses"), | |
259 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
260 ngx_conf_set_num_slot, | |
261 NGX_HTTP_LOC_CONF_OFFSET, | |
262 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_min_uses), | |
263 NULL }, | |
264 | |
265 { ngx_string("scgi_cache_use_stale"), | |
266 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
267 ngx_conf_set_bitmask_slot, | |
268 NGX_HTTP_LOC_CONF_OFFSET, | |
269 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_use_stale), | |
270 &ngx_http_scgi_next_upstream_masks }, | |
271 | |
272 { ngx_string("scgi_cache_methods"), | |
273 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
274 ngx_conf_set_bitmask_slot, | |
275 NGX_HTTP_LOC_CONF_OFFSET, | |
276 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_methods), | |
277 &ngx_http_upstream_cache_method_mask }, | |
278 | |
4386
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
279 { ngx_string("scgi_cache_lock"), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
280 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
281 ngx_conf_set_flag_slot, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
282 NGX_HTTP_LOC_CONF_OFFSET, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
283 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
284 NULL }, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
285 |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
286 { ngx_string("scgi_cache_lock_timeout"), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
287 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
288 ngx_conf_set_msec_slot, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
289 NGX_HTTP_LOC_CONF_OFFSET, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
290 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock_timeout), |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
291 NULL }, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
292 |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
293 { ngx_string("scgi_cache_lock_age"), |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
294 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
295 ngx_conf_set_msec_slot, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
296 NGX_HTTP_LOC_CONF_OFFSET, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
297 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_lock_age), |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
298 NULL }, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
299 |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
300 { ngx_string("scgi_cache_revalidate"), |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
301 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
302 ngx_conf_set_flag_slot, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
303 NGX_HTTP_LOC_CONF_OFFSET, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
304 offsetof(ngx_http_scgi_loc_conf_t, upstream.cache_revalidate), |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
305 NULL }, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
306 |
3637 | 307 #endif |
308 | |
309 { ngx_string("scgi_temp_path"), | |
310 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234, | |
311 ngx_conf_set_path_slot, | |
312 NGX_HTTP_LOC_CONF_OFFSET, | |
313 offsetof(ngx_http_scgi_loc_conf_t, upstream.temp_path), | |
314 NULL }, | |
315 | |
316 { ngx_string("scgi_max_temp_file_size"), | |
317 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
318 ngx_conf_set_size_slot, | |
319 NGX_HTTP_LOC_CONF_OFFSET, | |
320 offsetof(ngx_http_scgi_loc_conf_t, upstream.max_temp_file_size_conf), | |
321 NULL }, | |
322 | |
323 { ngx_string("scgi_temp_file_write_size"), | |
324 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
325 ngx_conf_set_size_slot, | |
326 NGX_HTTP_LOC_CONF_OFFSET, | |
327 offsetof(ngx_http_scgi_loc_conf_t, upstream.temp_file_write_size_conf), | |
328 NULL }, | |
329 | |
330 { ngx_string("scgi_next_upstream"), | |
331 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
332 ngx_conf_set_bitmask_slot, | |
333 NGX_HTTP_LOC_CONF_OFFSET, | |
334 offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream), | |
335 &ngx_http_scgi_next_upstream_masks }, | |
336 | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
337 { ngx_string("scgi_next_upstream_tries"), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
338 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
339 ngx_conf_set_num_slot, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
340 NGX_HTTP_LOC_CONF_OFFSET, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
341 offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream_tries), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
342 NULL }, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
343 |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
344 { ngx_string("scgi_next_upstream_timeout"), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
345 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
346 ngx_conf_set_msec_slot, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
347 NGX_HTTP_LOC_CONF_OFFSET, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
348 offsetof(ngx_http_scgi_loc_conf_t, upstream.next_upstream_timeout), |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
349 NULL }, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
350 |
3637 | 351 { ngx_string("scgi_param"), |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
352 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23, |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
353 ngx_http_upstream_param_set_slot, |
3637 | 354 NGX_HTTP_LOC_CONF_OFFSET, |
355 offsetof(ngx_http_scgi_loc_conf_t, params_source), | |
356 NULL }, | |
357 | |
358 { ngx_string("scgi_pass_header"), | |
3729 | 359 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3637 | 360 ngx_conf_set_str_array_slot, |
361 NGX_HTTP_LOC_CONF_OFFSET, | |
362 offsetof(ngx_http_scgi_loc_conf_t, upstream.pass_headers), | |
363 NULL }, | |
364 | |
365 { ngx_string("scgi_hide_header"), | |
3729 | 366 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
3637 | 367 ngx_conf_set_str_array_slot, |
368 NGX_HTTP_LOC_CONF_OFFSET, | |
369 offsetof(ngx_http_scgi_loc_conf_t, upstream.hide_headers), | |
370 NULL }, | |
371 | |
372 { ngx_string("scgi_ignore_headers"), | |
373 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, | |
374 ngx_conf_set_bitmask_slot, | |
375 NGX_HTTP_LOC_CONF_OFFSET, | |
376 offsetof(ngx_http_scgi_loc_conf_t, upstream.ignore_headers), | |
3667
12bd9e26fadb
use shared ngx_http_upstream_ignore_headers_masks[]
Igor Sysoev <igor@sysoev.ru>
parents:
3637
diff
changeset
|
377 &ngx_http_upstream_ignore_headers_masks }, |
3637 | 378 |
379 ngx_null_command | |
380 }; | |
381 | |
382 | |
383 static ngx_http_module_t ngx_http_scgi_module_ctx = { | |
384 NULL, /* preconfiguration */ | |
385 NULL, /* postconfiguration */ | |
386 | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
387 ngx_http_scgi_create_main_conf, /* create main configuration */ |
3637 | 388 NULL, /* init main configuration */ |
389 | |
390 NULL, /* create server configuration */ | |
391 NULL, /* merge server configuration */ | |
392 | |
393 ngx_http_scgi_create_loc_conf, /* create location configuration */ | |
394 ngx_http_scgi_merge_loc_conf /* merge location configuration */ | |
395 }; | |
396 | |
397 | |
398 ngx_module_t ngx_http_scgi_module = { | |
399 NGX_MODULE_V1, | |
400 &ngx_http_scgi_module_ctx, /* module context */ | |
401 ngx_http_scgi_commands, /* module directives */ | |
402 NGX_HTTP_MODULE, /* module type */ | |
403 NULL, /* init master */ | |
404 NULL, /* init module */ | |
405 NULL, /* init process */ | |
406 NULL, /* init thread */ | |
407 NULL, /* exit thread */ | |
408 NULL, /* exit process */ | |
409 NULL, /* exit master */ | |
410 NGX_MODULE_V1_PADDING | |
411 }; | |
412 | |
413 | |
414 static ngx_str_t ngx_http_scgi_hide_headers[] = { | |
415 ngx_string("Status"), | |
416 ngx_string("X-Accel-Expires"), | |
417 ngx_string("X-Accel-Redirect"), | |
418 ngx_string("X-Accel-Limit-Rate"), | |
419 ngx_string("X-Accel-Buffering"), | |
420 ngx_string("X-Accel-Charset"), | |
421 ngx_null_string | |
422 }; | |
423 | |
424 | |
425 #if (NGX_HTTP_CACHE) | |
426 | |
427 static ngx_keyval_t ngx_http_scgi_cache_headers[] = { | |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
428 { ngx_string("HTTP_IF_MODIFIED_SINCE"), |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
429 ngx_string("$upstream_cache_last_modified") }, |
3637 | 430 { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") }, |
5738
c95d7882dfc9
Upstream: cache revalidation using If-None-Match.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5575
diff
changeset
|
431 { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("$upstream_cache_etag") }, |
3637 | 432 { ngx_string("HTTP_IF_MATCH"), ngx_string("") }, |
433 { ngx_string("HTTP_RANGE"), ngx_string("") }, | |
434 { ngx_string("HTTP_IF_RANGE"), ngx_string("") }, | |
435 { ngx_null_string, ngx_null_string } | |
436 }; | |
437 | |
438 #endif | |
439 | |
440 | |
441 static ngx_path_init_t ngx_http_scgi_temp_path = { | |
442 ngx_string(NGX_HTTP_SCGI_TEMP_PATH), { 1, 2, 0 } | |
443 }; | |
444 | |
445 | |
446 static ngx_int_t | |
447 ngx_http_scgi_handler(ngx_http_request_t *r) | |
448 { | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
449 ngx_int_t rc; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
450 ngx_http_status_t *status; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
451 ngx_http_upstream_t *u; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
452 ngx_http_scgi_loc_conf_t *scf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
453 #if (NGX_HTTP_CACHE) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
454 ngx_http_scgi_main_conf_t *smcf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
455 #endif |
3637 | 456 |
457 if (ngx_http_upstream_create(r) != NGX_OK) { | |
458 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
459 } | |
460 | |
461 status = ngx_pcalloc(r->pool, sizeof(ngx_http_status_t)); | |
462 if (status == NULL) { | |
463 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
464 } | |
465 | |
466 ngx_http_set_ctx(r, status, ngx_http_scgi_module); | |
467 | |
468 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module); | |
469 | |
470 if (scf->scgi_lengths) { | |
471 if (ngx_http_scgi_eval(r, scf) != NGX_OK) { | |
472 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
473 } | |
474 } | |
475 | |
476 u = r->upstream; | |
477 | |
478 ngx_str_set(&u->schema, "scgi://"); | |
479 u->output.tag = (ngx_buf_tag_t) &ngx_http_scgi_module; | |
480 | |
481 u->conf = &scf->upstream; | |
482 | |
483 #if (NGX_HTTP_CACHE) | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
484 smcf = ngx_http_get_module_main_conf(r, ngx_http_scgi_module); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
485 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
486 u->caches = &smcf->caches; |
3637 | 487 u->create_key = ngx_http_scgi_create_key; |
488 #endif | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
489 |
3637 | 490 u->create_request = ngx_http_scgi_create_request; |
491 u->reinit_request = ngx_http_scgi_reinit_request; | |
492 u->process_header = ngx_http_scgi_process_status_line; | |
493 u->abort_request = ngx_http_scgi_abort_request; | |
494 u->finalize_request = ngx_http_scgi_finalize_request; | |
4615
adcd60233817
Added r->state reset on fastcgi/scgi/uwsgi request start.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
495 r->state = 0; |
3637 | 496 |
4157
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
497 u->buffering = scf->upstream.buffering; |
3637 | 498 |
499 u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t)); | |
500 if (u->pipe == NULL) { | |
501 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
502 } | |
503 | |
504 u->pipe->input_filter = ngx_event_pipe_copy_input_filter; | |
505 u->pipe->input_ctx = r; | |
506 | |
507 rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init); | |
508 | |
509 if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { | |
510 return rc; | |
511 } | |
512 | |
513 return NGX_DONE; | |
514 } | |
515 | |
516 | |
517 static ngx_int_t | |
518 ngx_http_scgi_eval(ngx_http_request_t *r, ngx_http_scgi_loc_conf_t * scf) | |
519 { | |
520 ngx_url_t url; | |
521 ngx_http_upstream_t *u; | |
522 | |
523 ngx_memzero(&url, sizeof(ngx_url_t)); | |
524 | |
525 if (ngx_http_script_run(r, &url.url, scf->scgi_lengths->elts, 0, | |
526 scf->scgi_values->elts) | |
527 == NULL) | |
528 { | |
529 return NGX_ERROR; | |
530 } | |
531 | |
532 url.no_resolve = 1; | |
533 | |
534 if (ngx_parse_url(r->pool, &url) != NGX_OK) { | |
535 if (url.err) { | |
536 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
537 "%s in upstream \"%V\"", url.err, &url.url); | |
538 } | |
539 | |
540 return NGX_ERROR; | |
541 } | |
542 | |
543 u = r->upstream; | |
544 | |
545 u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t)); | |
546 if (u->resolved == NULL) { | |
547 return NGX_ERROR; | |
548 } | |
549 | |
550 if (url.addrs && url.addrs[0].sockaddr) { | |
551 u->resolved->sockaddr = url.addrs[0].sockaddr; | |
552 u->resolved->socklen = url.addrs[0].socklen; | |
553 u->resolved->naddrs = 1; | |
554 u->resolved->host = url.addrs[0].name; | |
555 | |
556 } else { | |
557 u->resolved->host = url.host; | |
558 u->resolved->port = url.port; | |
3879
502a6b0acf3f
fix case when a host in fastcgi_pass, scgi_pass, and uwsgi_pass
Igor Sysoev <igor@sysoev.ru>
parents:
3731
diff
changeset
|
559 u->resolved->no_port = url.no_port; |
3637 | 560 } |
561 | |
562 return NGX_OK; | |
563 } | |
564 | |
565 | |
566 #if (NGX_HTTP_CACHE) | |
567 | |
568 static ngx_int_t | |
569 ngx_http_scgi_create_key(ngx_http_request_t *r) | |
570 { | |
571 ngx_str_t *key; | |
572 ngx_http_scgi_loc_conf_t *scf; | |
573 | |
574 key = ngx_array_push(&r->cache->keys); | |
575 if (key == NULL) { | |
576 return NGX_ERROR; | |
577 } | |
578 | |
579 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module); | |
580 | |
581 if (ngx_http_complex_value(r, &scf->cache_key, key) != NGX_OK) { | |
582 return NGX_ERROR; | |
583 } | |
584 | |
585 return NGX_OK; | |
586 } | |
587 | |
588 #endif | |
589 | |
590 | |
591 static ngx_int_t | |
592 ngx_http_scgi_create_request(ngx_http_request_t *r) | |
593 { | |
4929
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
594 off_t content_length_n; |
3637 | 595 u_char ch, *key, *val, *lowcase_key; |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
596 size_t len, key_len, val_len, allocated; |
3637 | 597 ngx_buf_t *b; |
4929
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
598 ngx_str_t content_length; |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
599 ngx_uint_t i, n, hash, skip_empty, header_params; |
3637 | 600 ngx_chain_t *cl, *body; |
601 ngx_list_part_t *part; | |
602 ngx_table_elt_t *header, **ignored; | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
603 ngx_http_scgi_params_t *params; |
3637 | 604 ngx_http_script_code_pt code; |
605 ngx_http_script_engine_t e, le; | |
606 ngx_http_scgi_loc_conf_t *scf; | |
607 ngx_http_script_len_code_pt lcode; | |
4929
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
608 u_char buffer[NGX_OFF_T_LEN]; |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
609 |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
610 content_length_n = 0; |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
611 body = r->upstream->request_bufs; |
3637 | 612 |
4929
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
613 while (body) { |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
614 content_length_n += ngx_buf_size(body->buf); |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
615 body = body->next; |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
616 } |
3637 | 617 |
4929
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
618 content_length.data = buffer; |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
619 content_length.len = ngx_sprintf(buffer, "%O", content_length_n) - buffer; |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
620 |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
621 len = sizeof("CONTENT_LENGTH") + content_length.len + 1; |
3637 | 622 |
623 header_params = 0; | |
624 ignored = NULL; | |
625 | |
626 scf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module); | |
627 | |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
628 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
629 params = r->upstream->cacheable ? &scf->params_cache : &scf->params; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
630 #else |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
631 params = &scf->params; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
632 #endif |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
633 |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
634 if (params->lengths) { |
3637 | 635 ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); |
636 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
637 ngx_http_script_flush_no_cacheable_variables(r, params->flushes); |
3637 | 638 le.flushed = 1; |
639 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
640 le.ip = params->lengths->elts; |
3637 | 641 le.request = r; |
642 | |
643 while (*(uintptr_t *) le.ip) { | |
644 | |
645 lcode = *(ngx_http_script_len_code_pt *) le.ip; | |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
646 key_len = lcode(&le); |
3637 | 647 |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
648 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
649 skip_empty = lcode(&le); |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
650 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
651 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { |
3637 | 652 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
653 } | |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
654 le.ip += sizeof(uintptr_t); |
4294
56cb2255735a
Fixed incorrect counting the length of headers in a SCGI request.
Valentin Bartenev <vbart@nginx.com>
parents:
4278
diff
changeset
|
655 |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
656 if (skip_empty && val_len == 0) { |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
657 continue; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
658 } |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
659 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
660 len += key_len + val_len + 1; |
3637 | 661 } |
662 } | |
663 | |
664 if (scf->upstream.pass_request_headers) { | |
665 | |
666 allocated = 0; | |
667 lowcase_key = NULL; | |
668 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
669 if (params->number) { |
4015
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
670 n = 0; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
671 part = &r->headers_in.headers.part; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
672 |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
673 while (part) { |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
674 n += part->nelts; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
675 part = part->next; |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
676 } |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
677 |
e0a435f5f504
Fix ignored headers handling in fastcgi/scgi/uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
3976
diff
changeset
|
678 ignored = ngx_palloc(r->pool, n * sizeof(void *)); |
3637 | 679 if (ignored == NULL) { |
680 return NGX_ERROR; | |
681 } | |
682 } | |
683 | |
684 part = &r->headers_in.headers.part; | |
685 header = part->elts; | |
686 | |
687 for (i = 0; /* void */; i++) { | |
688 | |
689 if (i >= part->nelts) { | |
690 if (part->next == NULL) { | |
691 break; | |
692 } | |
693 | |
694 part = part->next; | |
695 header = part->elts; | |
696 i = 0; | |
697 } | |
698 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
699 if (params->number) { |
3637 | 700 if (allocated < header[i].key.len) { |
701 allocated = header[i].key.len + 16; | |
702 lowcase_key = ngx_pnalloc(r->pool, allocated); | |
703 if (lowcase_key == NULL) { | |
704 return NGX_ERROR; | |
705 } | |
706 } | |
707 | |
708 hash = 0; | |
709 | |
710 for (n = 0; n < header[i].key.len; n++) { | |
711 ch = header[i].key.data[n]; | |
712 | |
713 if (ch >= 'A' && ch <= 'Z') { | |
714 ch |= 0x20; | |
715 | |
716 } else if (ch == '-') { | |
717 ch = '_'; | |
718 } | |
719 | |
720 hash = ngx_hash(hash, ch); | |
721 lowcase_key[n] = ch; | |
722 } | |
723 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
724 if (ngx_hash_find(¶ms->hash, hash, lowcase_key, n)) { |
3637 | 725 ignored[header_params++] = &header[i]; |
726 continue; | |
727 } | |
728 } | |
729 | |
730 len += sizeof("HTTP_") - 1 + header[i].key.len + 1 | |
731 + header[i].value.len + 1; | |
732 } | |
733 } | |
734 | |
735 /* netstring: "length:" + packet + "," */ | |
736 | |
737 b = ngx_create_temp_buf(r->pool, NGX_SIZE_T_LEN + 1 + len + 1); | |
738 if (b == NULL) { | |
739 return NGX_ERROR; | |
740 } | |
741 | |
742 cl = ngx_alloc_chain_link(r->pool); | |
743 if (cl == NULL) { | |
744 return NGX_ERROR; | |
745 } | |
746 | |
747 cl->buf = b; | |
748 | |
4929
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
749 b->last = ngx_sprintf(b->last, "%ui:CONTENT_LENGTH%Z%V%Z", |
5a44d638cd27
Request body: recalculate size of a request body in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4615
diff
changeset
|
750 len, &content_length); |
3637 | 751 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
752 if (params->lengths) { |
3637 | 753 ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); |
754 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
755 e.ip = params->values->elts; |
3637 | 756 e.pos = b->last; |
757 e.request = r; | |
758 e.flushed = 1; | |
759 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
760 le.ip = params->lengths->elts; |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
761 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
762 while (*(uintptr_t *) le.ip) { |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
763 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
764 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
765 lcode(&le); /* key length */ |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
766 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
767 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
768 skip_empty = lcode(&le); |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
769 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
770 for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
771 lcode = *(ngx_http_script_len_code_pt *) le.ip; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
772 } |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
773 le.ip += sizeof(uintptr_t); |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
774 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
775 if (skip_empty && val_len == 0) { |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
776 e.skip = 1; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
777 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
778 while (*(uintptr_t *) e.ip) { |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
779 code = *(ngx_http_script_code_pt *) e.ip; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
780 code((ngx_http_script_engine_t *) &e); |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
781 } |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
782 e.ip += sizeof(uintptr_t); |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
783 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
784 e.skip = 0; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
785 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
786 continue; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
787 } |
3637 | 788 |
789 #if (NGX_DEBUG) | |
790 key = e.pos; | |
791 #endif | |
792 code = *(ngx_http_script_code_pt *) e.ip; | |
793 code((ngx_http_script_engine_t *) & e); | |
794 | |
795 #if (NGX_DEBUG) | |
796 val = e.pos; | |
797 #endif | |
798 while (*(uintptr_t *) e.ip) { | |
799 code = *(ngx_http_script_code_pt *) e.ip; | |
800 code((ngx_http_script_engine_t *) &e); | |
801 } | |
802 *e.pos++ = '\0'; | |
803 e.ip += sizeof(uintptr_t); | |
804 | |
805 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
806 "scgi param: \"%s: %s\"", key, val); | |
807 } | |
808 | |
809 b->last = e.pos; | |
810 } | |
811 | |
812 if (scf->upstream.pass_request_headers) { | |
813 | |
814 part = &r->headers_in.headers.part; | |
815 header = part->elts; | |
816 | |
817 for (i = 0; /* void */; i++) { | |
818 | |
819 if (i >= part->nelts) { | |
820 if (part->next == NULL) { | |
821 break; | |
822 } | |
823 | |
824 part = part->next; | |
825 header = part->elts; | |
826 i = 0; | |
827 } | |
828 | |
829 for (n = 0; n < header_params; n++) { | |
830 if (&header[i] == ignored[n]) { | |
831 goto next; | |
832 } | |
833 } | |
834 | |
835 key = b->last; | |
836 b->last = ngx_cpymem(key, "HTTP_", sizeof("HTTP_") - 1); | |
837 | |
838 for (n = 0; n < header[i].key.len; n++) { | |
839 ch = header[i].key.data[n]; | |
840 | |
841 if (ch >= 'a' && ch <= 'z') { | |
842 ch &= ~0x20; | |
843 | |
844 } else if (ch == '-') { | |
845 ch = '_'; | |
846 } | |
847 | |
848 *b->last++ = ch; | |
849 } | |
850 | |
851 *b->last++ = (u_char) 0; | |
852 | |
853 val = b->last; | |
854 b->last = ngx_copy(val, header[i].value.data, header[i].value.len); | |
855 *b->last++ = (u_char) 0; | |
856 | |
857 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
858 "scgi param: \"%s: %s\"", key, val); | |
859 | |
860 next: | |
861 | |
862 continue; | |
863 } | |
864 } | |
865 | |
866 *b->last++ = (u_char) ','; | |
867 | |
868 if (scf->upstream.pass_request_body) { | |
869 body = r->upstream->request_bufs; | |
870 r->upstream->request_bufs = cl; | |
871 | |
872 while (body) { | |
873 b = ngx_alloc_buf(r->pool); | |
874 if (b == NULL) { | |
875 return NGX_ERROR; | |
876 } | |
877 | |
878 ngx_memcpy(b, body->buf, sizeof(ngx_buf_t)); | |
879 | |
880 cl->next = ngx_alloc_chain_link(r->pool); | |
881 if (cl->next == NULL) { | |
882 return NGX_ERROR; | |
883 } | |
884 | |
885 cl = cl->next; | |
886 cl->buf = b; | |
887 | |
888 body = body->next; | |
889 } | |
890 | |
891 } else { | |
892 r->upstream->request_bufs = cl; | |
893 } | |
894 | |
895 cl->next = NULL; | |
896 | |
897 return NGX_OK; | |
898 } | |
899 | |
900 | |
901 static ngx_int_t | |
902 ngx_http_scgi_reinit_request(ngx_http_request_t *r) | |
903 { | |
904 ngx_http_status_t *status; | |
905 | |
906 status = ngx_http_get_module_ctx(r, ngx_http_scgi_module); | |
907 | |
908 if (status == NULL) { | |
909 return NGX_OK; | |
910 } | |
911 | |
912 status->code = 0; | |
913 status->count = 0; | |
914 status->start = NULL; | |
915 status->end = NULL; | |
916 | |
917 r->upstream->process_header = ngx_http_scgi_process_status_line; | |
4615
adcd60233817
Added r->state reset on fastcgi/scgi/uwsgi request start.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4593
diff
changeset
|
918 r->state = 0; |
3637 | 919 |
920 return NGX_OK; | |
921 } | |
922 | |
923 | |
924 static ngx_int_t | |
925 ngx_http_scgi_process_status_line(ngx_http_request_t *r) | |
926 { | |
927 size_t len; | |
928 ngx_int_t rc; | |
929 ngx_http_status_t *status; | |
930 ngx_http_upstream_t *u; | |
931 | |
932 status = ngx_http_get_module_ctx(r, ngx_http_scgi_module); | |
933 | |
934 if (status == NULL) { | |
935 return NGX_ERROR; | |
936 } | |
937 | |
938 u = r->upstream; | |
939 | |
940 rc = ngx_http_parse_status_line(r, &u->buffer, status); | |
941 | |
942 if (rc == NGX_AGAIN) { | |
943 return rc; | |
944 } | |
945 | |
946 if (rc == NGX_ERROR) { | |
947 u->process_header = ngx_http_scgi_process_header; | |
948 return ngx_http_scgi_process_header(r); | |
949 } | |
950 | |
5575
d15822784cf9
Upstream: fix $upstream_status variable.
Piotr Sikora <piotr@cloudflare.com>
parents:
5496
diff
changeset
|
951 if (u->state && u->state->status == 0) { |
3637 | 952 u->state->status = status->code; |
953 } | |
954 | |
955 u->headers_in.status_n = status->code; | |
956 | |
957 len = status->end - status->start; | |
958 u->headers_in.status_line.len = len; | |
959 | |
960 u->headers_in.status_line.data = ngx_pnalloc(r->pool, len); | |
961 if (u->headers_in.status_line.data == NULL) { | |
962 return NGX_ERROR; | |
963 } | |
964 | |
965 ngx_memcpy(u->headers_in.status_line.data, status->start, len); | |
966 | |
967 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
968 "http scgi status %ui \"%V\"", | |
969 u->headers_in.status_n, &u->headers_in.status_line); | |
970 | |
971 u->process_header = ngx_http_scgi_process_header; | |
972 | |
973 return ngx_http_scgi_process_header(r); | |
974 } | |
975 | |
976 | |
977 static ngx_int_t | |
978 ngx_http_scgi_process_header(ngx_http_request_t *r) | |
979 { | |
980 ngx_str_t *status_line; | |
981 ngx_int_t rc, status; | |
982 ngx_table_elt_t *h; | |
983 ngx_http_upstream_t *u; | |
984 ngx_http_upstream_header_t *hh; | |
985 ngx_http_upstream_main_conf_t *umcf; | |
986 | |
987 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); | |
988 | |
989 for ( ;; ) { | |
990 | |
991 rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1); | |
992 | |
993 if (rc == NGX_OK) { | |
994 | |
995 /* a header line has been parsed successfully */ | |
996 | |
997 h = ngx_list_push(&r->upstream->headers_in.headers); | |
998 if (h == NULL) { | |
999 return NGX_ERROR; | |
1000 } | |
1001 | |
1002 h->hash = r->header_hash; | |
1003 | |
1004 h->key.len = r->header_name_end - r->header_name_start; | |
1005 h->value.len = r->header_end - r->header_start; | |
1006 | |
1007 h->key.data = ngx_pnalloc(r->pool, | |
1008 h->key.len + 1 + h->value.len + 1 | |
1009 + h->key.len); | |
1010 if (h->key.data == NULL) { | |
1011 return NGX_ERROR; | |
1012 } | |
1013 | |
1014 h->value.data = h->key.data + h->key.len + 1; | |
1015 h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; | |
1016 | |
4529
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1017 ngx_memcpy(h->key.data, r->header_name_start, h->key.len); |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1018 h->key.data[h->key.len] = '\0'; |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1019 ngx_memcpy(h->value.data, r->header_start, h->value.len); |
1ebec1d15a25
Fixed incorrect ngx_cpystrn() usage in ngx_http_*_process_header().
Maxim Dounin <mdounin@mdounin.ru>
parents:
4522
diff
changeset
|
1020 h->value.data[h->value.len] = '\0'; |
3637 | 1021 |
1022 if (h->key.len == r->lowcase_index) { | |
1023 ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); | |
1024 | |
1025 } else { | |
1026 ngx_strlow(h->lowcase_key, h->key.data, h->key.len); | |
1027 } | |
1028 | |
1029 hh = ngx_hash_find(&umcf->headers_in_hash, h->hash, | |
1030 h->lowcase_key, h->key.len); | |
1031 | |
1032 if (hh && hh->handler(r, h, hh->offset) != NGX_OK) { | |
1033 return NGX_ERROR; | |
1034 } | |
1035 | |
1036 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1037 "http scgi header: \"%V: %V\"", &h->key, &h->value); | |
1038 | |
1039 continue; | |
1040 } | |
1041 | |
1042 if (rc == NGX_HTTP_PARSE_HEADER_DONE) { | |
1043 | |
1044 /* a whole header has been parsed successfully */ | |
1045 | |
1046 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1047 "http scgi header done"); | |
1048 | |
4371
16ebad9447ee
Fixed incorrect use of r->http_version in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4331
diff
changeset
|
1049 u = r->upstream; |
16ebad9447ee
Fixed incorrect use of r->http_version in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4331
diff
changeset
|
1050 |
16ebad9447ee
Fixed incorrect use of r->http_version in scgi module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4331
diff
changeset
|
1051 if (u->headers_in.status_n) { |
5078
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1052 goto done; |
3637 | 1053 } |
1054 | |
1055 if (u->headers_in.status) { | |
1056 status_line = &u->headers_in.status->value; | |
1057 | |
1058 status = ngx_atoi(status_line->data, 3); | |
1059 if (status == NGX_ERROR) { | |
1060 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1061 "upstream sent invalid status \"%V\"", | |
1062 status_line); | |
1063 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | |
1064 } | |
1065 | |
1066 u->headers_in.status_n = status; | |
1067 u->headers_in.status_line = *status_line; | |
1068 | |
1069 } else if (u->headers_in.location) { | |
1070 u->headers_in.status_n = 302; | |
1071 ngx_str_set(&u->headers_in.status_line, | |
1072 "302 Moved Temporarily"); | |
1073 | |
1074 } else { | |
1075 u->headers_in.status_n = 200; | |
1076 ngx_str_set(&u->headers_in.status_line, "200 OK"); | |
1077 } | |
1078 | |
5575
d15822784cf9
Upstream: fix $upstream_status variable.
Piotr Sikora <piotr@cloudflare.com>
parents:
5496
diff
changeset
|
1079 if (u->state && u->state->status == 0) { |
3637 | 1080 u->state->status = u->headers_in.status_n; |
1081 } | |
1082 | |
5078
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1083 done: |
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1084 |
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1085 if (u->headers_in.status_n == NGX_HTTP_SWITCHING_PROTOCOLS |
5080
8da37c1b22a4
Trailing whitespace fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5078
diff
changeset
|
1086 && r->headers_in.upgrade) |
5078
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1087 { |
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1088 u->upgrade = 1; |
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1089 } |
10c74d3b15d1
Connection upgrade support in uwsgi and scgi modules.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5008
diff
changeset
|
1090 |
3637 | 1091 return NGX_OK; |
1092 } | |
1093 | |
1094 if (rc == NGX_AGAIN) { | |
1095 return NGX_AGAIN; | |
1096 } | |
1097 | |
1098 /* there was error while a header line parsing */ | |
1099 | |
1100 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, | |
1101 "upstream sent invalid header"); | |
1102 | |
1103 return NGX_HTTP_UPSTREAM_INVALID_HEADER; | |
1104 } | |
1105 } | |
1106 | |
1107 | |
1108 static void | |
1109 ngx_http_scgi_abort_request(ngx_http_request_t *r) | |
1110 { | |
1111 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1112 "abort http scgi request"); | |
1113 | |
1114 return; | |
1115 } | |
1116 | |
1117 | |
1118 static void | |
1119 ngx_http_scgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc) | |
1120 { | |
1121 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
1122 "finalize http scgi request"); | |
1123 | |
1124 return; | |
1125 } | |
1126 | |
1127 | |
1128 static void * | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1129 ngx_http_scgi_create_main_conf(ngx_conf_t *cf) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1130 { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1131 ngx_http_scgi_main_conf_t *conf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1132 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1133 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_main_conf_t)); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1134 if (conf == NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1135 return NULL; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1136 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1137 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1138 #if (NGX_HTTP_CACHE) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1139 if (ngx_array_init(&conf->caches, cf->pool, 4, |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1140 sizeof(ngx_http_file_cache_t *)) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1141 != NGX_OK) |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1142 { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1143 return NULL; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1144 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1145 #endif |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1146 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1147 return conf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1148 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1149 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1150 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1151 static void * |
3637 | 1152 ngx_http_scgi_create_loc_conf(ngx_conf_t *cf) |
1153 { | |
1154 ngx_http_scgi_loc_conf_t *conf; | |
1155 | |
1156 conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_scgi_loc_conf_t)); | |
1157 if (conf == NULL) { | |
1158 return NULL; | |
1159 } | |
1160 | |
1161 conf->upstream.store = NGX_CONF_UNSET; | |
1162 conf->upstream.store_access = NGX_CONF_UNSET_UINT; | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1163 conf->upstream.next_upstream_tries = NGX_CONF_UNSET_UINT; |
3637 | 1164 conf->upstream.buffering = NGX_CONF_UNSET; |
1165 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; | |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
1166 conf->upstream.force_ranges = NGX_CONF_UNSET; |
3637 | 1167 |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4947
diff
changeset
|
1168 conf->upstream.local = NGX_CONF_UNSET_PTR; |
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4947
diff
changeset
|
1169 |
3637 | 1170 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
1171 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; | |
1172 conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC; | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1173 conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC; |
3637 | 1174 |
1175 conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE; | |
1176 conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE; | |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
1177 conf->upstream.limit_rate = NGX_CONF_UNSET_SIZE; |
3637 | 1178 |
1179 conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE; | |
1180 conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE; | |
1181 conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE; | |
1182 | |
1183 conf->upstream.pass_request_headers = NGX_CONF_UNSET; | |
1184 conf->upstream.pass_request_body = NGX_CONF_UNSET; | |
1185 | |
1186 #if (NGX_HTTP_CACHE) | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1187 conf->upstream.cache = NGX_CONF_UNSET; |
3637 | 1188 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT; |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1189 conf->upstream.cache_bypass = NGX_CONF_UNSET_PTR; |
3693
e3bcc2f4c418
fix scgi_no_cache and uwsgi_no_cache initialization
Igor Sysoev <igor@sysoev.ru>
parents:
3692
diff
changeset
|
1190 conf->upstream.no_cache = NGX_CONF_UNSET_PTR; |
3637 | 1191 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR; |
4386
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1192 conf->upstream.cache_lock = NGX_CONF_UNSET; |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1193 conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC; |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
1194 conf->upstream.cache_lock_age = NGX_CONF_UNSET_MSEC; |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
1195 conf->upstream.cache_revalidate = NGX_CONF_UNSET; |
3637 | 1196 #endif |
1197 | |
1198 conf->upstream.hide_headers = NGX_CONF_UNSET_PTR; | |
1199 conf->upstream.pass_headers = NGX_CONF_UNSET_PTR; | |
1200 | |
1201 conf->upstream.intercept_errors = NGX_CONF_UNSET; | |
1202 | |
1203 /* "scgi_cyclic_temp_file" is disabled */ | |
1204 conf->upstream.cyclic_temp_file = 0; | |
1205 | |
4157
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
1206 conf->upstream.change_buffering = 1; |
9d59a8eda373
Added uwsgi_buffering and scgi_buffering directives.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4015
diff
changeset
|
1207 |
3976
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3879
diff
changeset
|
1208 ngx_str_set(&conf->upstream.module, "scgi"); |
215fe9223419
update r3945 with more descriptive error message
Igor Sysoev <igor@sysoev.ru>
parents:
3879
diff
changeset
|
1209 |
3637 | 1210 return conf; |
1211 } | |
1212 | |
1213 | |
1214 static char * | |
1215 ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | |
1216 { | |
1217 ngx_http_scgi_loc_conf_t *prev = parent; | |
1218 ngx_http_scgi_loc_conf_t *conf = child; | |
1219 | |
1220 size_t size; | |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1221 ngx_int_t rc; |
3637 | 1222 ngx_hash_init_t hash; |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1223 ngx_http_core_loc_conf_t *clcf; |
3637 | 1224 |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1225 #if (NGX_HTTP_CACHE) |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1226 |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1227 if (conf->upstream.store > 0) { |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1228 conf->upstream.cache = 0; |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1229 } |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1230 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1231 if (conf->upstream.cache > 0) { |
5948
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1232 conf->upstream.store = 0; |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1233 } |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1234 |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1235 #endif |
f2ff0aa89126
Upstream: mutually exclusive inheritance of "cache" and "store".
Valentin Bartenev <vbart@nginx.com>
parents:
5947
diff
changeset
|
1236 |
5940
e3b3b89d74e8
Upstream: fixed inheritance of proxy_store and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5938
diff
changeset
|
1237 if (conf->upstream.store == NGX_CONF_UNSET) { |
3637 | 1238 ngx_conf_merge_value(conf->upstream.store, prev->upstream.store, 0); |
1239 | |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
1240 conf->upstream.store_lengths = prev->upstream.store_lengths; |
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
1241 conf->upstream.store_values = prev->upstream.store_values; |
3637 | 1242 } |
1243 | |
1244 ngx_conf_merge_uint_value(conf->upstream.store_access, | |
1245 prev->upstream.store_access, 0600); | |
1246 | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1247 ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1248 prev->upstream.next_upstream_tries, 0); |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1249 |
3637 | 1250 ngx_conf_merge_value(conf->upstream.buffering, |
1251 prev->upstream.buffering, 1); | |
1252 | |
1253 ngx_conf_merge_value(conf->upstream.ignore_client_abort, | |
1254 prev->upstream.ignore_client_abort, 0); | |
1255 | |
5874
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
1256 ngx_conf_merge_value(conf->upstream.force_ranges, |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
1257 prev->upstream.force_ranges, 0); |
2aff40b3dea2
Upstream: proxy_force_ranges and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5832
diff
changeset
|
1258 |
5008
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4947
diff
changeset
|
1259 ngx_conf_merge_ptr_value(conf->upstream.local, |
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4947
diff
changeset
|
1260 prev->upstream.local, NULL); |
fd84344f1df7
Fixed and improved the "*_bind" directives of proxying modules.
Ruslan Ermilov <ru@nginx.com>
parents:
4947
diff
changeset
|
1261 |
3637 | 1262 ngx_conf_merge_msec_value(conf->upstream.connect_timeout, |
1263 prev->upstream.connect_timeout, 60000); | |
1264 | |
1265 ngx_conf_merge_msec_value(conf->upstream.send_timeout, | |
1266 prev->upstream.send_timeout, 60000); | |
1267 | |
1268 ngx_conf_merge_msec_value(conf->upstream.read_timeout, | |
1269 prev->upstream.read_timeout, 60000); | |
1270 | |
5832
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1271 ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout, |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1272 prev->upstream.next_upstream_timeout, 0); |
d09b689911ac
Upstream: limited next_upstream time and tries (ticket #544).
Roman Arutyunyan <arut@nginx.com>
parents:
5829
diff
changeset
|
1273 |
3637 | 1274 ngx_conf_merge_size_value(conf->upstream.send_lowat, |
1275 prev->upstream.send_lowat, 0); | |
1276 | |
1277 ngx_conf_merge_size_value(conf->upstream.buffer_size, | |
1278 prev->upstream.buffer_size, | |
1279 (size_t) ngx_pagesize); | |
1280 | |
5883
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
1281 ngx_conf_merge_size_value(conf->upstream.limit_rate, |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
1282 prev->upstream.limit_rate, 0); |
973ee2276300
Upstream: proxy_limit_rate and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5874
diff
changeset
|
1283 |
3637 | 1284 |
1285 ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs, | |
1286 8, ngx_pagesize); | |
1287 | |
1288 if (conf->upstream.bufs.num < 2) { | |
1289 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1290 "there must be at least 2 \"scgi_buffers\""); | |
1291 return NGX_CONF_ERROR; | |
1292 } | |
1293 | |
1294 | |
1295 size = conf->upstream.buffer_size; | |
1296 if (size < conf->upstream.bufs.size) { | |
1297 size = conf->upstream.bufs.size; | |
1298 } | |
1299 | |
1300 | |
1301 ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf, | |
1302 prev->upstream.busy_buffers_size_conf, | |
1303 NGX_CONF_UNSET_SIZE); | |
1304 | |
1305 if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) { | |
1306 conf->upstream.busy_buffers_size = 2 * size; | |
1307 } else { | |
1308 conf->upstream.busy_buffers_size = | |
1309 conf->upstream.busy_buffers_size_conf; | |
1310 } | |
1311 | |
1312 if (conf->upstream.busy_buffers_size < size) { | |
1313 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1314 "\"scgi_busy_buffers_size\" must be equal to or greater " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1315 "than the maximum of the value of \"scgi_buffer_size\" and " |
3637 | 1316 "one of the \"scgi_buffers\""); |
1317 | |
1318 return NGX_CONF_ERROR; | |
1319 } | |
1320 | |
1321 if (conf->upstream.busy_buffers_size | |
1322 > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size) | |
1323 { | |
1324 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1325 "\"scgi_busy_buffers_size\" must be less than " | |
1326 "the size of all \"scgi_buffers\" minus one buffer"); | |
1327 | |
1328 return NGX_CONF_ERROR; | |
1329 } | |
1330 | |
1331 | |
1332 ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf, | |
1333 prev->upstream.temp_file_write_size_conf, | |
1334 NGX_CONF_UNSET_SIZE); | |
1335 | |
1336 if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) { | |
1337 conf->upstream.temp_file_write_size = 2 * size; | |
1338 } else { | |
1339 conf->upstream.temp_file_write_size = | |
1340 conf->upstream.temp_file_write_size_conf; | |
1341 } | |
1342 | |
1343 if (conf->upstream.temp_file_write_size < size) { | |
1344 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1345 "\"scgi_temp_file_write_size\" must be equal to or greater than " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1346 "the maximum of the value of \"scgi_buffer_size\" and " |
3637 | 1347 "one of the \"scgi_buffers\""); |
1348 | |
1349 return NGX_CONF_ERROR; | |
1350 } | |
1351 | |
1352 | |
1353 ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf, | |
1354 prev->upstream.max_temp_file_size_conf, | |
1355 NGX_CONF_UNSET_SIZE); | |
1356 | |
1357 if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) { | |
1358 conf->upstream.max_temp_file_size = 1024 * 1024 * 1024; | |
1359 } else { | |
1360 conf->upstream.max_temp_file_size = | |
1361 conf->upstream.max_temp_file_size_conf; | |
1362 } | |
1363 | |
1364 if (conf->upstream.max_temp_file_size != 0 | |
5828 | 1365 && conf->upstream.max_temp_file_size < size) |
1366 { | |
3637 | 1367 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
1368 "\"scgi_max_temp_file_size\" must be equal to zero to disable " | |
4593
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1369 "temporary files usage or must be equal to or greater than " |
834049edae24
Fixed grammar in error messages.
Ruslan Ermilov <ru@nginx.com>
parents:
4529
diff
changeset
|
1370 "the maximum of the value of \"scgi_buffer_size\" and " |
3637 | 1371 "one of the \"scgi_buffers\""); |
1372 | |
1373 return NGX_CONF_ERROR; | |
1374 } | |
1375 | |
1376 | |
1377 ngx_conf_merge_bitmask_value(conf->upstream.ignore_headers, | |
1378 prev->upstream.ignore_headers, | |
1379 NGX_CONF_BITMASK_SET); | |
1380 | |
1381 | |
1382 ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, | |
1383 prev->upstream.next_upstream, | |
1384 (NGX_CONF_BITMASK_SET | |
1385 |NGX_HTTP_UPSTREAM_FT_ERROR | |
1386 |NGX_HTTP_UPSTREAM_FT_TIMEOUT)); | |
1387 | |
1388 if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) { | |
1389 conf->upstream.next_upstream = NGX_CONF_BITMASK_SET | |
1390 |NGX_HTTP_UPSTREAM_FT_OFF; | |
1391 } | |
1392 | |
1393 if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path, | |
1394 prev->upstream.temp_path, | |
1395 &ngx_http_scgi_temp_path) | |
1396 != NGX_OK) | |
1397 { | |
1398 return NGX_CONF_ERROR; | |
1399 } | |
1400 | |
1401 #if (NGX_HTTP_CACHE) | |
1402 | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1403 if (conf->upstream.cache == NGX_CONF_UNSET) { |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1404 ngx_conf_merge_value(conf->upstream.cache, |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1405 prev->upstream.cache, 0); |
3637 | 1406 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1407 conf->upstream.cache_zone = prev->upstream.cache_zone; |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1408 conf->upstream.cache_value = prev->upstream.cache_value; |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1409 } |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1410 |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1411 if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) { |
3637 | 1412 ngx_shm_zone_t *shm_zone; |
1413 | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1414 shm_zone = conf->upstream.cache_zone; |
3637 | 1415 |
1416 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | |
1417 "\"scgi_cache\" zone \"%V\" is unknown", | |
1418 &shm_zone->shm.name); | |
1419 | |
1420 return NGX_CONF_ERROR; | |
1421 } | |
1422 | |
1423 ngx_conf_merge_uint_value(conf->upstream.cache_min_uses, | |
1424 prev->upstream.cache_min_uses, 1); | |
1425 | |
1426 ngx_conf_merge_bitmask_value(conf->upstream.cache_use_stale, | |
1427 prev->upstream.cache_use_stale, | |
1428 (NGX_CONF_BITMASK_SET | |
1429 |NGX_HTTP_UPSTREAM_FT_OFF)); | |
1430 | |
1431 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_OFF) { | |
1432 conf->upstream.cache_use_stale = NGX_CONF_BITMASK_SET | |
1433 |NGX_HTTP_UPSTREAM_FT_OFF; | |
1434 } | |
1435 | |
4401
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1436 if (conf->upstream.cache_use_stale & NGX_HTTP_UPSTREAM_FT_ERROR) { |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1437 conf->upstream.cache_use_stale |= NGX_HTTP_UPSTREAM_FT_NOLIVE; |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1438 } |
d45742815c90
Fixed proxy_cache_use_stale in "no live upstreams" case.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4386
diff
changeset
|
1439 |
3637 | 1440 if (conf->upstream.cache_methods == 0) { |
1441 conf->upstream.cache_methods = prev->upstream.cache_methods; | |
1442 } | |
1443 | |
1444 conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD; | |
1445 | |
3699
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1446 ngx_conf_merge_ptr_value(conf->upstream.cache_bypass, |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1447 prev->upstream.cache_bypass, NULL); |
b0a0686a85bb
proxy_cache_pass, fastcgi_cache_bypass, uwsgi_cache_bypass, scgi_cache_bypass
Igor Sysoev <igor@sysoev.ru>
parents:
3693
diff
changeset
|
1448 |
3637 | 1449 ngx_conf_merge_ptr_value(conf->upstream.no_cache, |
1450 prev->upstream.no_cache, NULL); | |
1451 | |
1452 ngx_conf_merge_ptr_value(conf->upstream.cache_valid, | |
1453 prev->upstream.cache_valid, NULL); | |
1454 | |
1455 if (conf->cache_key.value.data == NULL) { | |
1456 conf->cache_key = prev->cache_key; | |
1457 } | |
1458 | |
5829
906530c9ffd2
Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5828
diff
changeset
|
1459 if (conf->upstream.cache && conf->cache_key.value.data == NULL) { |
906530c9ffd2
Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5828
diff
changeset
|
1460 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, |
906530c9ffd2
Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5828
diff
changeset
|
1461 "no \"scgi_cache_key\" for \"scgi_cache\""); |
906530c9ffd2
Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5828
diff
changeset
|
1462 } |
906530c9ffd2
Added warning about unset cache keys.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5828
diff
changeset
|
1463 |
4386
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1464 ngx_conf_merge_value(conf->upstream.cache_lock, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1465 prev->upstream.cache_lock, 0); |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1466 |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1467 ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout, |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1468 prev->upstream.cache_lock_timeout, 5000); |
92deb73393f7
Cache lock support for fastcgi, scgi, uwsgi.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4373
diff
changeset
|
1469 |
5905
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
1470 ngx_conf_merge_msec_value(conf->upstream.cache_lock_age, |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
1471 prev->upstream.cache_lock_age, 5000); |
2f7e557eab5b
Cache: proxy_cache_lock_age and friends.
Roman Arutyunyan <arut@nginx.com>
parents:
5883
diff
changeset
|
1472 |
5441
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
1473 ngx_conf_merge_value(conf->upstream.cache_revalidate, |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
1474 prev->upstream.cache_revalidate, 0); |
43ccaf8e8728
Upstream: cache revalidation with conditional requests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5393
diff
changeset
|
1475 |
3637 | 1476 #endif |
1477 | |
1478 ngx_conf_merge_value(conf->upstream.pass_request_headers, | |
1479 prev->upstream.pass_request_headers, 1); | |
1480 ngx_conf_merge_value(conf->upstream.pass_request_body, | |
1481 prev->upstream.pass_request_body, 1); | |
1482 | |
1483 ngx_conf_merge_value(conf->upstream.intercept_errors, | |
1484 prev->upstream.intercept_errors, 0); | |
1485 | |
1486 hash.max_size = 512; | |
1487 hash.bucket_size = ngx_align(64, ngx_cacheline_size); | |
1488 hash.name = "scgi_hide_headers_hash"; | |
1489 | |
1490 if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream, | |
3670
2728c4e4a9ae
do not use a cache headers set to hide
Igor Sysoev <igor@sysoev.ru>
parents:
3668
diff
changeset
|
1491 &prev->upstream, ngx_http_scgi_hide_headers, &hash) |
3637 | 1492 != NGX_OK) |
1493 { | |
1494 return NGX_CONF_ERROR; | |
1495 } | |
1496 | |
5938
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1497 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1498 |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1499 if (clcf->noname |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1500 && conf->upstream.upstream == NULL && conf->scgi_lengths == NULL) |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1501 { |
3637 | 1502 conf->upstream.upstream = prev->upstream.upstream; |
1503 conf->scgi_lengths = prev->scgi_lengths; | |
1504 conf->scgi_values = prev->scgi_values; | |
1505 } | |
1506 | |
5938
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1507 if (clcf->lmt_excpt && clcf->handler == NULL |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1508 && (conf->upstream.upstream || conf->scgi_lengths)) |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1509 { |
cd2abf7e7740
Upstream: fixed unexpected inheritance into limit_except blocks.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5937
diff
changeset
|
1510 clcf->handler = ngx_http_scgi_handler; |
3731
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1511 } |
72cc5b789021
inherit proxy_pass, fastcgi_pass, uwsgi_pass, scgi_pass inside
Igor Sysoev <igor@sysoev.ru>
parents:
3729
diff
changeset
|
1512 |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1513 if (conf->params_source == NULL) { |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1514 conf->params = prev->params; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1515 #if (NGX_HTTP_CACHE) |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1516 conf->params_cache = prev->params_cache; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1517 #endif |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1518 conf->params_source = prev->params_source; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1519 } |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1520 |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1521 rc = ngx_http_scgi_init_params(cf, conf, &conf->params, NULL); |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1522 if (rc != NGX_OK) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1523 return NGX_CONF_ERROR; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1524 } |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1525 |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1526 #if (NGX_HTTP_CACHE) |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1527 |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1528 if (conf->upstream.cache) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1529 rc = ngx_http_scgi_init_params(cf, conf, &conf->params_cache, |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1530 ngx_http_scgi_cache_headers); |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1531 if (rc != NGX_OK) { |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1532 return NGX_CONF_ERROR; |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1533 } |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1534 } |
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1535 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1536 #endif |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1537 |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1538 return NGX_CONF_OK; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1539 } |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1540 |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1541 |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1542 static ngx_int_t |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1543 ngx_http_scgi_init_params(ngx_conf_t *cf, ngx_http_scgi_loc_conf_t *conf, |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1544 ngx_http_scgi_params_t *params, ngx_keyval_t *default_params) |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1545 { |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1546 u_char *p; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1547 size_t size; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1548 uintptr_t *code; |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1549 ngx_uint_t i, nsrc; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1550 ngx_array_t headers_names, params_merged; |
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1551 ngx_keyval_t *h; |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1552 ngx_hash_key_t *hk; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1553 ngx_hash_init_t hash; |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1554 ngx_http_upstream_param_t *src, *s; |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1555 ngx_http_script_compile_t sc; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1556 ngx_http_script_copy_code_t *copy; |
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1557 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1558 if (params->hash.buckets) { |
5907
195561ef367f
Upstream: moved header initializations to separate functions.
Roman Arutyunyan <arut@nginx.com>
parents:
5906
diff
changeset
|
1559 return NGX_OK; |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1560 } |
3637 | 1561 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1562 if (conf->params_source == NULL && default_params == NULL) { |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1563 params->hash.buckets = (void *) 1; |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1564 return NGX_OK; |
3637 | 1565 } |
1566 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1567 params->lengths = ngx_array_create(cf->pool, 64, 1); |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1568 if (params->lengths == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1569 return NGX_ERROR; |
3637 | 1570 } |
1571 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1572 params->values = ngx_array_create(cf->pool, 512, 1); |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1573 if (params->values == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1574 return NGX_ERROR; |
3637 | 1575 } |
1576 | |
1577 if (ngx_array_init(&headers_names, cf->temp_pool, 4, sizeof(ngx_hash_key_t)) | |
1578 != NGX_OK) | |
1579 { | |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1580 return NGX_ERROR; |
3637 | 1581 } |
1582 | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1583 if (conf->params_source) { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1584 src = conf->params_source->elts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1585 nsrc = conf->params_source->nelts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1586 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1587 } else { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1588 src = NULL; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1589 nsrc = 0; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1590 } |
3637 | 1591 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1592 if (default_params) { |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1593 if (ngx_array_init(¶ms_merged, cf->temp_pool, 4, |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1594 sizeof(ngx_http_upstream_param_t)) |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1595 != NGX_OK) |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1596 { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1597 return NGX_ERROR; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1598 } |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1599 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1600 for (i = 0; i < nsrc; i++) { |
3637 | 1601 |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1602 s = ngx_array_push(¶ms_merged); |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1603 if (s == NULL) { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1604 return NGX_ERROR; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1605 } |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1606 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1607 *s = src[i]; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1608 } |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1609 |
5909
8d0cf26ce071
Upstream: different header lists for cached and uncached requests.
Roman Arutyunyan <arut@nginx.com>
parents:
5908
diff
changeset
|
1610 h = default_params; |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1611 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1612 while (h->key.len) { |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1613 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1614 src = params_merged.elts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1615 nsrc = params_merged.nelts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1616 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1617 for (i = 0; i < nsrc; i++) { |
3637 | 1618 if (ngx_strcasecmp(h->key.data, src[i].key.data) == 0) { |
1619 goto next; | |
1620 } | |
1621 } | |
1622 | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1623 s = ngx_array_push(¶ms_merged); |
3637 | 1624 if (s == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1625 return NGX_ERROR; |
3637 | 1626 } |
1627 | |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1628 s->key = h->key; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1629 s->value = h->value; |
5451
e68af4e3396f
Upstream: skip empty cache headers.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5441
diff
changeset
|
1630 s->skip_empty = 1; |
3637 | 1631 |
1632 next: | |
1633 | |
1634 h++; | |
1635 } | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1636 |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1637 src = params_merged.elts; |
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1638 nsrc = params_merged.nelts; |
3637 | 1639 } |
1640 | |
4278
f57229cba7ad
Fixed fastcgi/scgi/uwsgi_param inheritance.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4277
diff
changeset
|
1641 for (i = 0; i < nsrc; i++) { |
3637 | 1642 |
1643 if (src[i].key.len > sizeof("HTTP_") - 1 | |
1644 && ngx_strncmp(src[i].key.data, "HTTP_", sizeof("HTTP_") - 1) == 0) | |
1645 { | |
1646 hk = ngx_array_push(&headers_names); | |
1647 if (hk == NULL) { | |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1648 return NGX_ERROR; |
3637 | 1649 } |
1650 | |
1651 hk->key.len = src[i].key.len - 5; | |
1652 hk->key.data = src[i].key.data + 5; | |
1653 hk->key_hash = ngx_hash_key_lc(hk->key.data, hk->key.len); | |
1654 hk->value = (void *) 1; | |
1655 | |
1656 if (src[i].value.len == 0) { | |
1657 continue; | |
1658 } | |
1659 } | |
1660 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1661 copy = ngx_array_push_n(params->lengths, |
3637 | 1662 sizeof(ngx_http_script_copy_code_t)); |
1663 if (copy == NULL) { | |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1664 return NGX_ERROR; |
3637 | 1665 } |
1666 | |
1667 copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code; | |
1668 copy->len = src[i].key.len + 1; | |
1669 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1670 copy = ngx_array_push_n(params->lengths, |
4331
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1671 sizeof(ngx_http_script_copy_code_t)); |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1672 if (copy == NULL) { |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1673 return NGX_ERROR; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1674 } |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1675 |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1676 copy->code = (ngx_http_script_code_pt) ngx_http_script_copy_len_code; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1677 copy->len = src[i].skip_empty; |
059260de158d
SCGI: added "if_not_empty" flag support to the "scgi_param" directive.
Valentin Bartenev <vbart@nginx.com>
parents:
4294
diff
changeset
|
1678 |
3637 | 1679 |
1680 size = (sizeof(ngx_http_script_copy_code_t) | |
1681 + src[i].key.len + 1 + sizeof(uintptr_t) - 1) | |
1682 & ~(sizeof(uintptr_t) - 1); | |
1683 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1684 copy = ngx_array_push_n(params->values, size); |
3637 | 1685 if (copy == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1686 return NGX_ERROR; |
3637 | 1687 } |
1688 | |
1689 copy->code = ngx_http_script_copy_code; | |
1690 copy->len = src[i].key.len + 1; | |
1691 | |
1692 p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t); | |
1693 (void) ngx_cpystrn(p, src[i].key.data, src[i].key.len + 1); | |
1694 | |
1695 | |
1696 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
1697 | |
1698 sc.cf = cf; | |
1699 sc.source = &src[i].value; | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1700 sc.flushes = ¶ms->flushes; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1701 sc.lengths = ¶ms->lengths; |
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1702 sc.values = ¶ms->values; |
3637 | 1703 |
1704 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1705 return NGX_ERROR; |
3637 | 1706 } |
1707 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1708 code = ngx_array_push_n(params->lengths, sizeof(uintptr_t)); |
3637 | 1709 if (code == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1710 return NGX_ERROR; |
3637 | 1711 } |
1712 | |
1713 *code = (uintptr_t) NULL; | |
1714 | |
1715 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1716 code = ngx_array_push_n(params->values, sizeof(uintptr_t)); |
3637 | 1717 if (code == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1718 return NGX_ERROR; |
3637 | 1719 } |
1720 | |
1721 *code = (uintptr_t) NULL; | |
1722 } | |
1723 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1724 code = ngx_array_push_n(params->lengths, sizeof(uintptr_t)); |
3637 | 1725 if (code == NULL) { |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1726 return NGX_ERROR; |
3637 | 1727 } |
1728 | |
1729 *code = (uintptr_t) NULL; | |
1730 | |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1731 params->number = headers_names.nelts; |
3637 | 1732 |
5908
f8e80f8c7fc7
Upstream: moved header lists to separate structures.
Roman Arutyunyan <arut@nginx.com>
parents:
5907
diff
changeset
|
1733 hash.hash = ¶ms->hash; |
3637 | 1734 hash.key = ngx_hash_key_lc; |
1735 hash.max_size = 512; | |
1736 hash.bucket_size = 64; | |
1737 hash.name = "scgi_params_hash"; | |
1738 hash.pool = cf->pool; | |
1739 hash.temp_pool = NULL; | |
1740 | |
4277
e4b8255e44c3
Separate functions to merge fastcgi/scgi/uwsgi params.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4157
diff
changeset
|
1741 return ngx_hash_init(&hash, headers_names.elts, headers_names.nelts); |
3637 | 1742 } |
1743 | |
1744 | |
1745 static char * | |
1746 ngx_http_scgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1747 { | |
1748 ngx_http_scgi_loc_conf_t *scf = conf; | |
1749 | |
1750 ngx_url_t u; | |
1751 ngx_str_t *value, *url; | |
1752 ngx_uint_t n; | |
1753 ngx_http_core_loc_conf_t *clcf; | |
1754 ngx_http_script_compile_t sc; | |
1755 | |
1756 if (scf->upstream.upstream || scf->scgi_lengths) { | |
1757 return "is duplicate"; | |
1758 } | |
1759 | |
5758
f3df4e420ae7
Style: remove whitespace between function name and parentheses.
Piotr Sikora <piotr@cloudflare.com>
parents:
5738
diff
changeset
|
1760 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); |
3637 | 1761 clcf->handler = ngx_http_scgi_handler; |
1762 | |
1763 value = cf->args->elts; | |
1764 | |
1765 url = &value[1]; | |
1766 | |
1767 n = ngx_http_script_variables_count(url); | |
1768 | |
1769 if (n) { | |
1770 | |
1771 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
1772 | |
1773 sc.cf = cf; | |
1774 sc.source = url; | |
1775 sc.lengths = &scf->scgi_lengths; | |
1776 sc.values = &scf->scgi_values; | |
1777 sc.variables = n; | |
1778 sc.complete_lengths = 1; | |
1779 sc.complete_values = 1; | |
1780 | |
1781 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
1782 return NGX_CONF_ERROR; | |
1783 } | |
1784 | |
1785 return NGX_CONF_OK; | |
1786 } | |
1787 | |
1788 ngx_memzero(&u, sizeof(ngx_url_t)); | |
1789 | |
1790 u.url = value[1]; | |
1791 u.no_resolve = 1; | |
1792 | |
1793 scf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0); | |
1794 if (scf->upstream.upstream == NULL) { | |
1795 return NGX_CONF_ERROR; | |
1796 } | |
1797 | |
1798 if (clcf->name.data[clcf->name.len - 1] == '/') { | |
1799 clcf->auto_redirect = 1; | |
1800 } | |
1801 | |
1802 return NGX_CONF_OK; | |
1803 } | |
1804 | |
1805 | |
1806 static char * | |
1807 ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1808 { | |
1809 ngx_http_scgi_loc_conf_t *scf = conf; | |
1810 | |
1811 ngx_str_t *value; | |
1812 ngx_http_script_compile_t sc; | |
1813 | |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
1814 if (scf->upstream.store != NGX_CONF_UNSET) { |
3637 | 1815 return "is duplicate"; |
1816 } | |
1817 | |
1818 value = cf->args->elts; | |
1819 | |
1820 if (ngx_strcmp(value[1].data, "off") == 0) { | |
1821 scf->upstream.store = 0; | |
1822 return NGX_CONF_OK; | |
1823 } | |
1824 | |
1825 #if (NGX_HTTP_CACHE) | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1826 if (scf->upstream.cache > 0) { |
3637 | 1827 return "is incompatible with \"scgi_cache\""; |
1828 } | |
1829 #endif | |
1830 | |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
1831 scf->upstream.store = 1; |
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
1832 |
3637 | 1833 if (ngx_strcmp(value[1].data, "on") == 0) { |
1834 return NGX_CONF_OK; | |
1835 } | |
1836 | |
1837 /* include the terminating '\0' into script */ | |
1838 value[1].len++; | |
1839 | |
1840 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
1841 | |
1842 sc.cf = cf; | |
1843 sc.source = &value[1]; | |
1844 sc.lengths = &scf->upstream.store_lengths; | |
1845 sc.values = &scf->upstream.store_values; | |
5496
9d056f10fb99
Style: removed surplus semicolons.
Valentin Bartenev <vbart@nginx.com>
parents:
5451
diff
changeset
|
1846 sc.variables = ngx_http_script_variables_count(&value[1]); |
3637 | 1847 sc.complete_lengths = 1; |
1848 sc.complete_values = 1; | |
1849 | |
1850 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
1851 return NGX_CONF_ERROR; | |
1852 } | |
1853 | |
1854 return NGX_CONF_OK; | |
1855 } | |
1856 | |
1857 | |
1858 #if (NGX_HTTP_CACHE) | |
1859 | |
1860 static char * | |
1861 ngx_http_scgi_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1862 { | |
1863 ngx_http_scgi_loc_conf_t *scf = conf; | |
1864 | |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1865 ngx_str_t *value; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1866 ngx_http_complex_value_t cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1867 ngx_http_compile_complex_value_t ccv; |
3637 | 1868 |
1869 value = cf->args->elts; | |
1870 | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1871 if (scf->upstream.cache != NGX_CONF_UNSET) { |
3637 | 1872 return "is duplicate"; |
1873 } | |
1874 | |
1875 if (ngx_strcmp(value[1].data, "off") == 0) { | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1876 scf->upstream.cache = 0; |
3637 | 1877 return NGX_CONF_OK; |
1878 } | |
1879 | |
5947
d9025ea1f5a5
Upstream: simplified proxy_store and friends configuration code.
Valentin Bartenev <vbart@nginx.com>
parents:
5940
diff
changeset
|
1880 if (scf->upstream.store > 0) { |
3637 | 1881 return "is incompatible with \"scgi_store\""; |
1882 } | |
1883 | |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1884 scf->upstream.cache = 1; |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1885 |
5951
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1886 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1887 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1888 ccv.cf = cf; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1889 ccv.value = &value[1]; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1890 ccv.complex_value = &cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1891 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1892 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1893 return NGX_CONF_ERROR; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1894 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1895 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1896 if (cv.lengths != NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1897 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1898 scf->upstream.cache_value = ngx_palloc(cf->pool, |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1899 sizeof(ngx_http_complex_value_t)); |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1900 if (scf->upstream.cache_value == NULL) { |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1901 return NGX_CONF_ERROR; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1902 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1903 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1904 *scf->upstream.cache_value = cv; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1905 |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1906 return NGX_CONF_OK; |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1907 } |
610832763648
Upstream: added variables support to proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5949
diff
changeset
|
1908 |
5949
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1909 scf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1910 &ngx_http_scgi_module); |
634da79665d3
Upstream: refactored proxy_cache and friends.
Valentin Bartenev <vbart@nginx.com>
parents:
5948
diff
changeset
|
1911 if (scf->upstream.cache_zone == NULL) { |
3637 | 1912 return NGX_CONF_ERROR; |
1913 } | |
1914 | |
1915 return NGX_CONF_OK; | |
1916 } | |
1917 | |
1918 | |
1919 static char * | |
1920 ngx_http_scgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
1921 { | |
1922 ngx_http_scgi_loc_conf_t *scf = conf; | |
1923 | |
1924 ngx_str_t *value; | |
1925 ngx_http_compile_complex_value_t ccv; | |
1926 | |
1927 value = cf->args->elts; | |
1928 | |
4947
4251e72b8bb4
Allow the complex value to be defined as an empty string.
Ruslan Ermilov <ru@nginx.com>
parents:
4929
diff
changeset
|
1929 if (scf->cache_key.value.data) { |
3637 | 1930 return "is duplicate"; |
1931 } | |
1932 | |
1933 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
1934 | |
1935 ccv.cf = cf; | |
1936 ccv.value = &value[1]; | |
1937 ccv.complex_value = &scf->cache_key; | |
1938 | |
1939 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
1940 return NGX_CONF_ERROR; | |
1941 } | |
1942 | |
1943 return NGX_CONF_OK; | |
1944 } | |
1945 | |
1946 #endif |