]> granicus.if.org Git - apache/commitdiff
Restore the ability to specify host names on Listen directives.
authorJeff Trawick <trawick@apache.org>
Wed, 31 Jul 2002 12:44:55 +0000 (12:44 +0000)
committerJeff Trawick <trawick@apache.org>
Wed, 31 Jul 2002 12:44:55 +0000 (12:44 +0000)
We needed to compare on the value we pass to apr_sockaddr_info_get(),
not the IP address string.  Sometimes this is an IP address string
and sometimes it is a host name.  Otherwise, on the second pass
through this code we won't find the existing listen_rec for a Listen
directive which had a host name, and we'll create a new listen_rec
and try to bind again to the same addr/port.

PR:                  11030
Helped immensely by: David Shane Holden <dpejesh@yahoo.com>,
                     who debugged it and submitted a patch which
                     showed the problem; a much simpler change was
                     committed though

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96258 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/listen.c

diff --git a/CHANGES b/CHANGES
index 6c0fdcdc62de04341c4183c8e5e5677508484063..ffc740db477ec69f41fede9858840339576a038f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.40
 
+  *) Restore the ability to specify host names on Listen directives.
+     PR 11030.  [Jeff Trawick, David Shane Holden <dpejesh@yahoo.com>]
+
   *) When deciding on the default address family for listening sockets, 
      make sure we can actually bind to an AF_INET6 socket before
      deciding that we should default to AF_INET6.  This fixes a startup
index 60f936f4a85e9fdadd6573f4f9e6ba91470c5e3b..e57bef075e7ef79a364e8364af054710650dab10 100644 (file)
@@ -251,7 +251,6 @@ static const char *alloc_listener(process_rec *process, char *addr, apr_port_t p
     ap_listen_rec **walk;
     ap_listen_rec *new;
     apr_status_t status;
-    char *oldaddr;
     apr_port_t oldport;
     apr_sockaddr_t *sa;
 
@@ -279,8 +278,7 @@ static const char *alloc_listener(process_rec *process, char *addr, apr_port_t p
         /* Some listeners are not real so they will not have a bind_addr. */
         if (sa) {
             apr_sockaddr_port_get(&oldport, sa);
-            apr_sockaddr_ip_get(&oldaddr, sa);
-            if (!strcmp(oldaddr, addr) && port == oldport) {
+            if (!strcmp(sa->hostname, addr) && port == oldport) {
                 /* re-use existing record */
                 new = *walk;
                 *walk = new->next;