httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r123809 - /httpd/httpd/trunk/modules/proxy/proxy_util.c
Date Fri, 31 Dec 2004 17:01:07 GMT
Author: mturk
Date: Fri Dec 31 09:01:05 2004
New Revision: 123809

URL: http://svn.apache.org/viewcvs?view=rev&rev=123809
Log:
Do not cache hostname and port for forward and
reverse generic proxy workers. 
Modified:
   httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
Url: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/proxy_util.c?view=diff&rev=123809&p1=httpd/httpd/trunk/modules/proxy/proxy_util.c&r1=123808&p2=httpd/httpd/trunk/modules/proxy/proxy_util.c&r2=123809
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c	(original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c	Fri Dec 31 09:01:05 2004
@@ -1610,6 +1610,9 @@
 {
     int server_port;
     apr_status_t err = APR_SUCCESS;
+    const char   *hostname;
+    apr_port_t   port;
+    
     /*
      * Break up the URL to determine the host to connect to
      */
@@ -1648,12 +1651,25 @@
             conn->port = uri->port;
         }
     }
+    if (!worker->is_address_reusable) {
+        if (proxyname) {
+            hostname = proxyname;
+            port = proxyport;
+        } else {
+            hostname = uri->hostname;
+            port = uri->port;
+        }
+    }
+    else {
+        hostname = conn->hostname;
+        port = conn->port;
+    }
     /* TODO: add address cache for forward proxies */
     if (r->proxyreq == PROXYREQ_PROXY || r->proxyreq == PROXYREQ_REVERSE ||
         !worker->is_address_reusable) {
         err = apr_sockaddr_info_get(&(conn->addr),
-                                    conn->hostname, APR_UNSPEC,
-                                    conn->port, 0,
+                                    hostname, APR_UNSPEC,
+                                    port, 0,
                                     conn->pool);
     }
     else if (!worker->cp->addr) {
@@ -1669,8 +1685,8 @@
         * inside dynamic config to force the lookup.
         */
         err = apr_sockaddr_info_get(&(worker->cp->addr),
-                                    conn->hostname, APR_UNSPEC,
-                                    conn->port, 0,
+                                    hostname, APR_UNSPEC,
+                                    port, 0,
                                     worker->cp->pool);
         conn->addr = worker->cp->addr;
         PROXY_THREAD_UNLOCK(worker);
@@ -1678,7 +1694,7 @@
     if (err != APR_SUCCESS) {
         return ap_proxyerror(r, HTTP_BAD_GATEWAY,
                              apr_pstrcat(p, "DNS lookup failure for: ",
-                                         conn->hostname, NULL));
+                                         hostname, NULL));
     }
 
     /* Get the server port for the Via headers */

Mime
View raw message