From: David Reid Date: Fri, 3 Nov 2000 02:15:50 +0000 (+0000) Subject: We have functions that allow us to get the ports from the sockets, so use them X-Git-Tag: APACHE_2_0_ALPHA_8~184 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e878631436f77899b67f66cb4df0fe4107b3b565;p=apache We have functions that allow us to get the ports from the sockets, so use them here. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86816 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/util_script.c b/server/util_script.c index ee076a12ef..397340fa30 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -166,6 +166,7 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r) apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in); apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts; int i; + apr_uint32_t rport; /* use a temporary apr_table_t which we'll overlap onto * r->subprocess_env later @@ -256,8 +257,8 @@ 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_table_addn(e, "REMOTE_PORT", - apr_psprintf(r->pool, "%d", ntohs(c->remote_addr.sin_port))); + apr_get_remote_port(&rport, c->client_socket); + apr_table_addn(e, "REMOTE_PORT", apr_psprintf(r->pool, "%d", rport)); if (r->user) { apr_table_addn(e, "REMOTE_USER", r->user);