You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2013/08/23 18:00:48 UTC

svn commit: r1516911 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

Author: jim
Date: Fri Aug 23 16:00:47 2013
New Revision: 1516911

URL: http://svn.apache.org/r1516911
Log:
Save some cycles...

Modified:
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1516911&r1=1516910&r2=1516911&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Aug 23 16:00:47 2013
@@ -40,6 +40,7 @@
 
 APLOG_USE_MODULE(proxy);
 
+#define UDS_SOCKET_STRING "uds="
 /*
  * Opaque structure containing target server info when
  * using a forward proxy.
@@ -2119,7 +2120,7 @@ ap_proxy_determine_connection(apr_pool_t
      *      spilling the cached addr from the worker.
      */
     if (!conn->hostname || !worker->s->is_address_reusable ||
-        worker->s->disablereuse || strncmp(conn->hostname, "socket=", 7) == 0) {
+        worker->s->disablereuse || strncmp(conn->hostname, UDS_SOCKET_STRING, sizeof(UDS_SOCKET_STRING)-1) == 0) {
         if (proxyname) {
             conn->hostname = apr_pstrdup(conn->pool, proxyname);
             conn->port = proxyport;
@@ -2157,8 +2158,8 @@ ap_proxy_determine_connection(apr_pool_t
             conn->port = uri->port;
         }
         socket_cleanup(conn);
-        if (strncmp(conn->hostname, "socket=", 7) == 0) {
-            char *uds_path = apr_pstrdup(conn->pool, conn->hostname + 7);
+        if (strncmp(conn->hostname, UDS_SOCKET_STRING, sizeof(UDS_SOCKET_STRING)-1) == 0) {
+            char *uds_path = apr_pstrdup(conn->pool, conn->hostname + sizeof(UDS_SOCKET_STRING) - 1);
             decodeenc(uds_path);
             conn->uds_path = uds_path;
         }