# HG changeset patch # User Ruslan Ermilov # Date 1342500454 0 # Node ID 7ab10517ae5825129b53441b836e9d616d6593c8 # Parent 798e0377fd52158ea9879bce6144a71bbeabed89 Fixed sorting of listen addresses so that wildcard address is always at the end (closes #187). 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. diff -r 798e0377fd52 -r 7ab10517ae58 src/http/ngx_http.c --- a/src/http/ngx_http.c Tue Jul 17 04:42:38 2012 +0000 +++ b/src/http/ngx_http.c Tue Jul 17 04:47:34 2012 +0000 @@ -1613,6 +1613,11 @@ 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;