]> granicus.if.org Git - apache/commitdiff
This adds the APR_LOCAL/APR_REMOTE to APR and changes the apr_get/set_port
authorDavid Reid <dreid@apache.org>
Wed, 8 Nov 2000 14:47:33 +0000 (14:47 +0000)
committerDavid Reid <dreid@apache.org>
Wed, 8 Nov 2000 14:47:33 +0000 (14:47 +0000)
functions to use it.  This is onyl the start and I'll pause a while before
I continue in case people really hate this.  The patch can be backed out and
all evidence will be removed, but I think this makes maintaining/developing
the code easier in the long term.

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

modules/http/http_core.c
server/listen.c
server/rfc1413.c
server/util_script.c
server/vhost.c

index 00aacf44d0482854c4354019d777f16259fe0d8f..5d7ff22a76e83c1f95e7885828021c7cd3203add 100644 (file)
@@ -775,7 +775,7 @@ AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r)
     if (d->use_canonical_name == USE_CANONICAL_NAME_OFF
        || d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
         if (r->hostname)
-           apr_get_local_port(&port, r->connection->client_socket);
+           apr_get_port(&port, APR_LOCAL, r->connection->client_socket);
     }
     /* default */
     return port;
index 997a2e0eb885f3ca983a0458ac249de901eed104..673ac4351f05e4dc62be17dbba1d39bdd10f5041 100644 (file)
@@ -86,7 +86,7 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server)
     apr_port_t port;
     char *ipaddr;
 
-    apr_get_local_port(&port,s);
+    apr_get_port(&port, APR_LOCAL, s);
     apr_get_local_ipaddr(&ipaddr,s);
     apr_snprintf(addr, sizeof(addr), "address %s port %u", ipaddr,
                (unsigned) port);
@@ -182,7 +182,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_local_port(&oldport, (*walk)->sd);
+        apr_get_port(&oldport, APR_LOCAL, (*walk)->sd);
        apr_get_local_ipaddr(&oldaddr,(*walk)->sd);
        if (!strcmp(oldaddr, addr) && port == oldport) {
            /* re-use existing record */
@@ -202,7 +202,7 @@ static void alloc_listener(process_rec *process, char *addr, unsigned int port)
                  "make_sock: failed to get a socket for %s", addr);
         return;
     }
-    apr_set_local_port(new->sd, port);
+    apr_set_port(new->sd, APR_LOCAL, port);
     apr_set_local_ipaddr(new->sd, addr);
     new->next = ap_listeners;
     ap_listeners = new;
index 9535d9eb0df479b2ad94e118f0d356f1268f87ab..a981c77d34c27a7f7f331d52242febd804408aca 100644 (file)
@@ -129,7 +129,7 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
      * addresses from the query socket.
      */
 
-    apr_set_local_port(sock, ANY_PORT);
+    apr_set_port(sock, APR_LOCAL, ANY_PORT);
     apr_set_local_ipaddr(sock, local_ip);
 
     if ((status = apr_bind(sock)) != APR_SUCCESS) {
@@ -142,13 +142,13 @@ static int get_rfc1413(apr_socket_t *sock, const char *local_ip,
  * errors from connect usually imply the remote machine doesn't support
  * the service
  */
-    apr_set_remote_port(sock, RFC1413_PORT);
+    apr_set_port(sock, APR_REMOTE, RFC1413_PORT);
     apr_set_remote_ipaddr(sock, rmt_ip);
                     
     if (apr_connect(sock, NULL) != APR_SUCCESS)
         return -1;
-    apr_get_local_port(&sav_our_port, sock);
-    apr_get_remote_port(&sav_rmt_port, sock);
+    apr_get_port(&sav_our_port, APR_LOCAL, sock);
+    apr_get_port(&sav_rmt_port, APR_REMOTE, sock);
 
 /* send the data */
     buflen = apr_snprintf(buffer, sizeof(buffer), "%u,%u\r\n", sav_rmt_port,
index 4eb861742fcdab9a985618cf5c5e28b16a20ca1f..225a898fcba32655b773f65f8b2b41ffccd13b43 100644 (file)
@@ -257,7 +257,7 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r)
     apr_table_addn(e, "SERVER_ADMIN", s->server_admin);        /* Apache */
     apr_table_addn(e, "SCRIPT_FILENAME", r->filename); /* Apache */
 
-    apr_get_remote_port(&rport, c->client_socket);
+    apr_get_port(&rport, APR_REMOTE, c->client_socket);
     apr_table_addn(e, "REMOTE_PORT", apr_psprintf(r->pool, "%d", rport));
 
     if (r->user) {
index 3206af302451ec7a579b48d2941a42daf164fd16..2078e07416949a179a77dde62e9d73746ee658ff 100644 (file)
@@ -860,7 +860,7 @@ static void check_hostalias(request_rec *r)
     name_chain *src;
 
     last_s = NULL;
-    apr_get_local_port(&port, r->connection->client_socket);
+    apr_get_port(&port, APR_LOCAL, r->connection->client_socket);
 
     /* Recall that the name_chain is a list of server_addr_recs, some of
      * whose ports may not match.  Also each server may appear more than
@@ -915,7 +915,7 @@ static void check_serverpath(request_rec *r)
     server_rec *last_s;
     name_chain *src;
     apr_port_t port;
-    apr_get_local_port(&port, r->connection->client_socket);
+    apr_get_port(&port, APR_LOCAL, r->connection->client_socket);
    
     /*
      * This is in conjunction with the ServerPath code in http_core, so we
@@ -976,7 +976,7 @@ void ap_update_vhost_given_ip(conn_rec *conn)
 {
     ipaddr_chain *trav;
     apr_port_t port;
-    apr_get_local_port(&port, conn->client_socket);
+    apr_get_port(&port, APR_LOCAL, conn->client_socket);
 
     /* scan the hash apr_table_t for an exact match first */
     trav = find_ipaddr(&conn->local_addr.sin_addr, port);