diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-08-06 16:03:56 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-08-06 16:03:56 +0000 |
| commit | 50cb5ca3a59d0207b59c94c993d2ebba01cbc933 (patch) | |
| tree | 09c2c7bcf02fe6f2dc3ac34d61c7901bb2ccdc6b | |
| parent | 5f4fbaf71cd443a7f99094bc2e3e6c6115d7ff13 (diff) | |
| download | nginx-50cb5ca3a59d0207b59c94c993d2ebba01cbc933.tar.gz nginx-50cb5ca3a59d0207b59c94c993d2ebba01cbc933.tar.bz2 | |
Merge of r4756: fixed listen addresses sorting (ticket #187)
Fixed sorting of listen addresses so that wildcard address is always at
the end. Failure to do so could result in several listen sockets to be
created instead of only one listening on wildcard address.
Reported by Roman Odaisky.
| -rw-r--r-- | src/http/ngx_http.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c index 3e077fb95..f1f8a48e0 100644 --- a/src/http/ngx_http.c +++ b/src/http/ngx_http.c @@ -1613,6 +1613,11 @@ ngx_http_cmp_conf_addrs(const void *one, const void *two) return 1; } + if (second->opt.wildcard) { + /* a wildcard address must be the last resort, shift it to the end */ + return -1; + } + if (first->opt.bind && !second->opt.bind) { /* shift explicit bind()ed addresses to the start */ return -1; |
