diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-10-22 12:15:16 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-10-22 12:15:16 +0400 |
commit | 315cfa0ab3ca86371d25bafbb7482d0b3889a335 (patch) | |
tree | 6c921a3ac76dc89ad6247aa5023f041269c53993 /src/http/ngx_http.c | |
parent | acb43232f6944946f7441e4f4f3d9c10ad7f90d5 (diff) |
test a duplicate listen in a server
Diffstat (limited to 'src/http/ngx_http.c')
-rw-r--r-- | src/http/ngx_http.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c index e5387c4c3..cf47c23d9 100644 --- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c @@ -1289,6 +1289,7 @@ static ngx_int_t ngx_http_add_server(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, ngx_http_conf_addr_t *addr) { + ngx_uint_t i; ngx_http_core_srv_conf_t **server; if (addr->servers.elts == NULL) { @@ -1298,6 +1299,16 @@ ngx_http_add_server(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, { return NGX_ERROR; } + + } else { + server = addr->servers.elts; + for (i = 0; i < addr->servers.nelts; i++) { + if (server[i] == cscf) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "a duplicate listen %s", addr->opt.addr); + return NGX_ERROR; + } + } } server = ngx_array_push(&addr->servers); |