diff options
author | Igor Sysoev <igor@sysoev.ru> | 2009-10-22 14:17:54 +0400 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2009-10-22 14:17:54 +0400 |
commit | 657b3b7f7dded18d6aaaa3d8a3b130509904dc9d (patch) | |
tree | 8be58853aae7894e2951bf373d4a79b6fd071580 | |
parent | 663e9579575ca7b226ba5efa82253f619fcb7a94 (diff) |
fix r3225 and r3227: preserve default_server bit during listen options
overwriting
-rw-r--r-- | src/http/ngx_http.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c index cf47c23d9..455a519de 100644 --- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c @@ -1167,7 +1167,7 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, { u_char *p; size_t len, off; - ngx_uint_t i; + ngx_uint_t i, default_server; struct sockaddr *sa; ngx_http_conf_addr_t *addr; @@ -1209,6 +1209,9 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, return NGX_ERROR; } + /* preserve default_server bit during listen options overwriting */ + default_server = addr[i].opt.default_server; + if (lsopt->set) { if (addr[i].opt.set) { @@ -1224,15 +1227,18 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, if (lsopt->default_server) { - if (addr[i].opt.default_server) { + if (default_server) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "a duplicate default server for %s", addr[i].opt.addr); return NGX_ERROR; } + default_server = 1; addr[i].default_server = cscf; } + addr[i].opt.default_server = default_server; + return NGX_OK; } |