Mercurial > hg > nginx
comparison src/http/ngx_http_script.c @ 7439:5efc23d83bc2
Added the ngx_http_test_required_predicates() function.
In contrast to ngx_http_test_predicates(), it requires all values to be
non-empty and not equal to "0".
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 17 Jan 2019 14:31:04 +0300 |
parents | 9e25a5380a21 |
children | b82162b8496a |
comparison
equal
deleted
inserted
replaced
7438:134343f2a877 | 7439:5efc23d83bc2 |
---|---|
269 | 269 |
270 return NGX_OK; | 270 return NGX_OK; |
271 } | 271 } |
272 | 272 |
273 | 273 |
274 ngx_int_t | |
275 ngx_http_test_required_predicates(ngx_http_request_t *r, | |
276 ngx_array_t *predicates) | |
277 { | |
278 ngx_str_t val; | |
279 ngx_uint_t i; | |
280 ngx_http_complex_value_t *cv; | |
281 | |
282 if (predicates == NULL) { | |
283 return NGX_OK; | |
284 } | |
285 | |
286 cv = predicates->elts; | |
287 | |
288 for (i = 0; i < predicates->nelts; i++) { | |
289 if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) { | |
290 return NGX_ERROR; | |
291 } | |
292 | |
293 if (val.len == 0 || (val.len == 1 && val.data[0] == '0')) { | |
294 return NGX_DECLINED; | |
295 } | |
296 } | |
297 | |
298 return NGX_OK; | |
299 } | |
300 | |
301 | |
274 char * | 302 char * |
275 ngx_http_set_predicate_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 303 ngx_http_set_predicate_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
276 { | 304 { |
277 char *p = conf; | 305 char *p = conf; |
278 | 306 |