comparison src/http/ngx_http_script.c @ 631:b6a5942a4e6a NGINX_0_8_46

nginx 0.8.46 *) Change: now the "proxy_no_cache", "fastcgi_no_cache", "uwsgi_no_cache", and "scgi_no_cache" directives affect on a cached response saving only. *) Feature: the "proxy_cache_bypass", "fastcgi_cache_bypass", "uwsgi_cache_bypass", and "scgi_cache_bypass" directives. *) Bugfix: nginx did not free memory in cache keys zones if there was an error during working with backend: the memory was freed only after inactivity time or on memory low condition.
author Igor Sysoev <http://sysoev.ru>
date Mon, 19 Jul 2010 00:00:00 +0400
parents 4d3e880ce86c
children 6c96fdd2dfc3
comparison
equal deleted inserted replaced
630:913af46ee783 631:b6a5942a4e6a
209 209
210 return NGX_OK; 210 return NGX_OK;
211 } 211 }
212 212
213 213
214 ngx_int_t
215 ngx_http_test_predicates(ngx_http_request_t *r, ngx_array_t *predicates)
216 {
217 ngx_str_t val;
218 ngx_uint_t i;
219 ngx_http_complex_value_t *cv;
220
221 if (predicates == NULL) {
222 return NGX_OK;
223 }
224
225 cv = predicates->elts;
226
227 for (i = 0; i < predicates->nelts; i++) {
228 if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) {
229 return NGX_ERROR;
230 }
231
232 if (val.len && val.data[0] != '0') {
233 return NGX_DECLINED;
234 }
235 }
236
237 return NGX_OK;
238 }
239
240
241 char *
242 ngx_http_set_predicate_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
243 {
244 char *p = conf;
245
246 ngx_str_t *value;
247 ngx_uint_t i;
248 ngx_array_t **a;
249 ngx_http_complex_value_t *cv;
250 ngx_http_compile_complex_value_t ccv;
251
252 a = (ngx_array_t **) (p + cmd->offset);
253
254 if (*a == NGX_CONF_UNSET_PTR) {
255 *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t));
256 if (*a == NULL) {
257 return NGX_CONF_ERROR;
258 }
259 }
260
261 value = cf->args->elts;
262
263 for (i = 1; i < cf->args->nelts; i++) {
264 cv = ngx_array_push(*a);
265 if (cv == NULL) {
266 return NGX_CONF_ERROR;
267 }
268
269 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
270
271 ccv.cf = cf;
272 ccv.value = &value[i];
273 ccv.complex_value = cv;
274
275 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
276 return NGX_CONF_ERROR;
277 }
278 }
279
280 return NGX_CONF_OK;
281 }
282
283
214 ngx_uint_t 284 ngx_uint_t
215 ngx_http_script_variables_count(ngx_str_t *value) 285 ngx_http_script_variables_count(ngx_str_t *value)
216 { 286 {
217 ngx_uint_t i, n; 287 ngx_uint_t i, n;
218 288