You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2013/05/23 14:54:56 UTC

svn commit: r1485675 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS server/vhost.c

Author: jim
Date: Thu May 23 12:54:56 2013
New Revision: 1485675

URL: http://svn.apache.org/r1485675
Log:
Merge r1481306 from trunk:

PR54948: wildcard name-based vhosts printed twice in apachectl -S


Submitted by: covener
Reviewed/backported by: jim

Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/server/vhost.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1481306

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1485675&r1=1485674&r2=1485675&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Thu May 23 12:54:56 2013
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.5
 
+  *) core: apachectl -S prints wildcard name-based virtual hosts twice. 
+     PR54948 [Eric Covener]
+
   *) mod_proxy: Reject invalid values for Max-Forwards. [Graham Leggett,
      Co-Advisor <coad measurement-factory.com>]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1485675&r1=1485674&r2=1485675&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Thu May 23 12:54:56 2013
@@ -90,17 +90,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * mod_proxy: Reject invalid values for Max-Forwards.
-      trunk patch: http://svn.apache.org/r1481302
-                   http://svn.apache.org/r1481397
-      2.4.x patch: trunk patch works (minus CHANGES)
-      +1: minfrin, sf, jim
-
-    * core: PR54948 wildcard name-based virtual hosts printed twice in httpd -S
-      trunk patch: http://svn.apache.org/r1481306.
-      2.4.x patch: trunk works
-      +1 covener, minfrin, jim
-
     * mod_cache: Fix uninitialized tmppath variable. PR 54949
       trunk patch: Variable removed from trunk in http://svn.apache.org/r1407381
       2.4.x patch: http://people.apache.org/~minfrin/httpd-mod_cache-tmppath.patch

Modified: httpd/httpd/branches/2.4.x/server/vhost.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/vhost.c?rev=1485675&r1=1485674&r2=1485675&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/vhost.c (original)
+++ httpd/httpd/branches/2.4.x/server/vhost.c Thu May 23 12:54:56 2013
@@ -577,14 +577,21 @@ AP_DECLARE(void) ap_fini_vhost_config(ap
      */
 
     for (s = main_s->next; s; s = s->next) {
+        server_addr_rec *sar_prev = NULL;
         has_default_vhost_addr = 0;
         for (sar = s->addrs; sar; sar = sar->next) {
             ipaddr_chain *ic;
             char inaddr_any[16] = {0}; /* big enough to handle IPv4 or IPv6 */
-
+            /* XXX: this treats 0.0.0.0 as a "default" server which matches no-exact-match for IPv6 */
             if (!memcmp(sar->host_addr->ipaddr_ptr, inaddr_any, sar->host_addr->ipaddr_len)) {
                 ic = find_default_server(sar->host_port);
-                if (!ic || sar->host_port != ic->sar->host_port) {
+
+                if (ic && sar->host_port == ic->sar->host_port) { /* we're a match for an existing "default server"  */
+                    if (!sar_prev || memcmp(sar_prev->host_addr->ipaddr_ptr, inaddr_any, sar_prev->host_addr->ipaddr_len)) { 
+                        add_name_vhost_config(p, main_s, s, sar, ic);
+                    }
+                }
+                else { 
                     /* No default server, or we found a default server but
                     ** exactly one of us is a wildcard port, which means we want
                     ** two ip-based vhosts not an NVH with two names
@@ -592,6 +599,7 @@ AP_DECLARE(void) ap_fini_vhost_config(ap
                     ic = new_ipaddr_chain(p, s, sar);
                     ic->next = default_list;
                     default_list = ic;
+                    add_name_vhost_config(p, main_s, s, sar, ic);
                 }
                 has_default_vhost_addr = 1;
             }
@@ -609,8 +617,9 @@ AP_DECLARE(void) ap_fini_vhost_config(ap
                     ic->next = *iphash_table_tail[bucket];
                     *iphash_table_tail[bucket] = ic;
                 }
+                add_name_vhost_config(p, main_s, s, sar, ic);
             }
-            add_name_vhost_config(p, main_s, s, sar, ic);
+            sar_prev = sar;
         }
 
         /* Ok now we want to set up a server_hostname if the user was