diff src/http/ngx_http.c @ 4792:0f55013dde39 stable-1.2

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 06 Aug 2012 16:03:56 +0000
parents 67653855682e
children c0f7b94e88ba
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -1613,6 +1613,11 @@ ngx_http_cmp_conf_addrs(const void *one,
         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;