]> granicus.if.org Git - apache/commitdiff
Change the code to reflect the recent API changes...
authorDavid Reid <dreid@apache.org>
Thu, 9 Nov 2000 15:09:50 +0000 (15:09 +0000)
committerDavid Reid <dreid@apache.org>
Thu, 9 Nov 2000 15:09:50 +0000 (15:09 +0000)
Alter http_vhost.c to use the new apr_get_inaddr fucntion.  Old code is still
there just in case it breaks.  can someone check it who knows this stuff?

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

server/connection.c
server/listen.c
server/rfc1413.c
server/vhost.c

index 50ce7cbe5b4634d89622b7ddb618c6c4599826d6..6f07ec763b083998cbce7f5db77d48ab1294648c 100644 (file)
@@ -284,12 +284,12 @@ conn_rec *ap_new_connection(apr_pool_t *p, server_rec *server,
 
     conn->pool = p;
     conn->local_addr = *saddr;
-    apr_get_local_ipaddr(&conn->local_ip, inout);
+    apr_get_ipaddr(&conn->local_ip, APR_LOCAL, inout);
     conn->base_server = server;
     conn->client_socket = inout;
 
     conn->remote_addr = *remaddr;
-    apr_get_remote_ipaddr(&conn->remote_ip, inout);   
+    apr_get_ipaddr(&conn->remote_ip, APR_REMOTE, inout);   
     conn->id = id;
 
     return conn;
index 673ac4351f05e4dc62be17dbba1d39bdd10f5041..a3b964642ba1df0f5a1e36592f8ef5c651ce0c43 100644 (file)
@@ -87,7 +87,7 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
     char *ipaddr;
 
     apr_get_port(&port, APR_LOCAL, s);
-    apr_get_local_ipaddr(&ipaddr,s);
+    apr_get_ipaddr(&ipaddr, APR_LOCAL, s);
     apr_snprintf(addr, sizeof(addr), "address %s port %u", ipaddr,
                (unsigned) port);
 
@@ -183,7 +183,7 @@ static void alloc_listener(process_rec *process, char *addr, unsigned int port)
     /* see if we've got an old listener for this address:port */
     for (walk = &old_listeners; *walk; walk = &(*walk)->next) {
         apr_get_port(&oldport, APR_LOCAL, (*walk)->sd);
-       apr_get_local_ipaddr(&oldaddr,(*walk)->sd);
+       apr_get_ipaddr(&oldaddr, APR_LOCAL, (*walk)->sd);
        if (!strcmp(oldaddr, addr) && port == oldport) {
            /* re-use existing record */
            new = *walk;
@@ -203,7 +203,7 @@ static void alloc_listener(process_rec *process, char *addr, unsigned int port)
         return;
     }
     apr_set_port(new->sd, APR_LOCAL, port);
-    apr_set_local_ipaddr(new->sd, addr);
+    apr_set_ipaddr(new->sd, APR_LOCAL, addr);
     new->next = ap_listeners;
     ap_listeners = new;
 }
index 8e5d3430bd537ab8522f97ccbfcd56bfe015833c..a7a90c2ba53d9f6c73069e8b68dd4ed0a3ef875e 100644 (file)
@@ -130,7 +130,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
      */
 
     apr_set_port(sock, APR_LOCAL, ANY_PORT);
-    apr_set_local_ipaddr(sock, local_ip);
+    apr_set_ipaddr(sock, APR_LOCAL, local_ip);
 
     if ((status = apr_bind(sock)) != APR_SUCCESS) {
        ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
@@ -143,7 +143,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
  * the service
  */
     apr_set_port(sock, APR_REMOTE, RFC1413_PORT);
-    apr_set_remote_ipaddr(sock, rmt_ip);
+    apr_set_ipaddr(sock, APR_REMOTE, rmt_ip);
                     
     if (apr_connect(sock, NULL) != APR_SUCCESS)
         return -1;
index 2078e07416949a179a77dde62e9d73746ee658ff..edf9e0289c934978253f0754539dd25e030ebed3 100644 (file)
@@ -187,7 +187,7 @@ static const char *get_addresses(apr_pool_t *p, const char *w_,
                                 server_addr_rec ***paddr, apr_port_t port)
 {
     struct hostent *hep;
-    unsigned long my_addr;
+    apr_in_addr my_addr;
     server_addr_rec *sar;
     char *t;
     int i, is_an_ip_addr;
@@ -211,27 +211,41 @@ static const char *get_addresses(apr_pool_t *p, const char *w_,
        *t = 0;
     }
 
-    is_an_ip_addr = 0;
+    if (strcasecmp(w, "_default_") == 0
+        || strcmp(w, "255.255.255.255") == 0) {
+        my_addr.s_addr = DEFAULT_VHOST_ADDR;
+    } else {
+        if (apr_get_inaddr(&my_addr, w) != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL,
+                "Cannot resolve host name %s --- ignoring!", w);
+            return NULL;
+        }
+    }
+
+/*        
+   is_an_ip_addr = 0;
     if (strcmp(w, "*") == 0) {
-       my_addr = htonl(INADDR_ANY);
+       my_addr.s_addr = htonl(INADDR_ANY);
        is_an_ip_addr = 1;
     }
     else if (strcasecmp(w, "_default_") == 0
             || strcmp(w, "255.255.255.255") == 0) {
-       my_addr = DEFAULT_VHOST_ADDR;
+       my_addr.s_addr = DEFAULT_VHOST_ADDR;
        is_an_ip_addr = 1;
     }
-    else if ((my_addr = apr_inet_addr(w)) != INADDR_NONE) {
+    else if ((my_addr.s_addr = apr_inet_addr(w)) != INADDR_NONE) {
        is_an_ip_addr = 1;
     }
     if (is_an_ip_addr) {
+*/
        sar = apr_pcalloc(p, sizeof(server_addr_rec));
        **paddr = sar;
        *paddr = &sar->next;
-       sar->host_addr.s_addr = my_addr;
+       sar->host_addr = my_addr;
        sar->host_port = port;
        sar->virthost = apr_pstrdup(p, w);
        return NULL;
+/*
     }
 
     hep = gethostbyname(w);
@@ -250,7 +264,7 @@ static const char *get_addresses(apr_pool_t *p, const char *w_,
        sar->host_port = port;
        sar->virthost = apr_pstrdup(p, w);
     }
-
+*/
     return NULL;
 }