|
|
008793 |
--- a/server/vhost.c 2013/07/15 11:50:50 1503188
|
|
|
008793 |
+++ b/server/vhost.c 2013/10/03 18:31:22 1528958
|
|
|
008793 |
@@ -577,14 +577,22 @@
|
|
|
008793 |
*/
|
|
|
008793 |
|
|
|
008793 |
for (s = main_s->next; s; s = s->next) {
|
|
|
008793 |
+ server_addr_rec *sar_prev = NULL;
|
|
|
008793 |
has_default_vhost_addr = 0;
|
|
|
008793 |
for (sar = s->addrs; sar; sar = sar->next) {
|
|
|
008793 |
ipaddr_chain *ic;
|
|
|
008793 |
char inaddr_any[16] = {0}; /* big enough to handle IPv4 or IPv6 */
|
|
|
008793 |
-
|
|
|
008793 |
+ /* XXX: this treats 0.0.0.0 as a "default" server which matches no-exact-match for IPv6 */
|
|
|
008793 |
if (!memcmp(sar->host_addr->ipaddr_ptr, inaddr_any, sar->host_addr->ipaddr_len)) {
|
|
|
008793 |
ic = find_default_server(sar->host_port);
|
|
|
008793 |
- if (!ic || sar->host_port != ic->sar->host_port) {
|
|
|
008793 |
+
|
|
|
008793 |
+ if (ic && sar->host_port == ic->sar->host_port) { /* we're a match for an existing "default server" */
|
|
|
008793 |
+ if (!sar_prev || memcmp(sar_prev->host_addr->ipaddr_ptr, inaddr_any, sar_prev->host_addr->ipaddr_len)
|
|
|
008793 |
+ || sar_prev->host_port != sar->host_port) {
|
|
|
008793 |
+ add_name_vhost_config(p, main_s, s, sar, ic);
|
|
|
008793 |
+ }
|
|
|
008793 |
+ }
|
|
|
008793 |
+ else {
|
|
|
008793 |
/* No default server, or we found a default server but
|
|
|
008793 |
** exactly one of us is a wildcard port, which means we want
|
|
|
008793 |
** two ip-based vhosts not an NVH with two names
|
|
|
008793 |
@@ -592,6 +600,7 @@
|
|
|
008793 |
ic = new_ipaddr_chain(p, s, sar);
|
|
|
008793 |
ic->next = default_list;
|
|
|
008793 |
default_list = ic;
|
|
|
008793 |
+ add_name_vhost_config(p, main_s, s, sar, ic);
|
|
|
008793 |
}
|
|
|
008793 |
has_default_vhost_addr = 1;
|
|
|
008793 |
}
|
|
|
008793 |
@@ -609,8 +618,9 @@
|
|
|
008793 |
ic->next = *iphash_table_tail[bucket];
|
|
|
008793 |
*iphash_table_tail[bucket] = ic;
|
|
|
008793 |
}
|
|
|
008793 |
+ add_name_vhost_config(p, main_s, s, sar, ic);
|
|
|
008793 |
}
|
|
|
008793 |
- add_name_vhost_config(p, main_s, s, sar, ic);
|
|
|
008793 |
+ sar_prev = sar;
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
/* Ok now we want to set up a server_hostname if the user was
|