Mercurial > hg > nginx-quic
comparison src/stream/ngx_stream_access_module.c @ 6996:72188d1bcab5
Access: simplified rule parser code.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Mon, 15 May 2017 17:16:32 +0300 |
parents | 3908156a51fa |
children |
comparison
equal
deleted
inserted
replaced
6995:eb5d119323d8 | 6996:72188d1bcab5 |
---|---|
297 #endif | 297 #endif |
298 #if (NGX_HAVE_UNIX_DOMAIN) | 298 #if (NGX_HAVE_UNIX_DOMAIN) |
299 ngx_stream_access_rule_un_t *rule_un; | 299 ngx_stream_access_rule_un_t *rule_un; |
300 #endif | 300 #endif |
301 | 301 |
302 all = 0; | |
302 ngx_memzero(&cidr, sizeof(ngx_cidr_t)); | 303 ngx_memzero(&cidr, sizeof(ngx_cidr_t)); |
303 | 304 |
304 value = cf->args->elts; | 305 value = cf->args->elts; |
305 | 306 |
306 all = (value[1].len == 3 && ngx_strcmp(value[1].data, "all") == 0); | 307 if (value[1].len == 3 && ngx_strcmp(value[1].data, "all") == 0) { |
307 | 308 all = 1; |
308 if (!all) { | 309 |
309 | 310 #if (NGX_HAVE_UNIX_DOMAIN) |
310 #if (NGX_HAVE_UNIX_DOMAIN) | 311 } else if (value[1].len == 5 && ngx_strcmp(value[1].data, "unix:") == 0) { |
311 | 312 cidr.family = AF_UNIX; |
312 if (value[1].len == 5 && ngx_strcmp(value[1].data, "unix:") == 0) { | 313 #endif |
313 cidr.family = AF_UNIX; | 314 |
314 rc = NGX_OK; | 315 } else { |
315 | |
316 } else { | |
317 rc = ngx_ptocidr(&value[1], &cidr); | |
318 } | |
319 | |
320 #else | |
321 rc = ngx_ptocidr(&value[1], &cidr); | 316 rc = ngx_ptocidr(&value[1], &cidr); |
322 #endif | |
323 | 317 |
324 if (rc == NGX_ERROR) { | 318 if (rc == NGX_ERROR) { |
325 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 319 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
326 "invalid parameter \"%V\"", &value[1]); | 320 "invalid parameter \"%V\"", &value[1]); |
327 return NGX_CONF_ERROR; | 321 return NGX_CONF_ERROR; |