]> granicus.if.org Git - apache/commitdiff
Save some cycles...
authorJim Jagielski <jim@apache.org>
Fri, 23 Aug 2013 16:00:47 +0000 (16:00 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 23 Aug 2013 16:00:47 +0000 (16:00 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1516911 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/proxy_util.c

index b33c8d76c3054c84eb9bdb770245430a49b5ea5c..b7c10709f11ce16adbb8c43965a174eaefb54e73 100644 (file)
@@ -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 *p, request_rec *r,
      *      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 *p, request_rec *r,
             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;
         }