]> granicus.if.org Git - apache/commitdiff
Adjust url as required, following what we did to r->filename.
authorJim Jagielski <jim@apache.org>
Wed, 22 Jan 2014 22:26:49 +0000 (22:26 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 22 Jan 2014 22:26:49 +0000 (22:26 +0000)
Save some cycles when searching...

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

modules/proxy/proxy_util.c

index 79e30708799338c1a9e81f61e529066dc3237a1d..1a09ed71ac2d08554db50c35e63886a7a90da915 100644 (file)
@@ -1927,9 +1927,9 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
             }
         }
         else if (r->proxyreq == PROXYREQ_REVERSE) {
-            char *ptr;
-            const char *ptr2;
             if (conf->reverse) {
+                char *ptr;
+                char *ptr2;
                 ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
                               "*: found reverse proxy worker for %s", *url);
                 *balancer = NULL;
@@ -1946,10 +1946,13 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
                  * In the case of the generic reverse proxy, we need to see if we
                  * were passed a UDS url (eg: from mod_proxy) and adjust uds_path
                  * as required.
+                 *
+                 * NOTE: Here we use a quick note lookup, but we could also
+                 * check to see if r->filename starts with 'proxy:'
                  */
                 if (apr_table_get(r->notes, "rewrite-proxy") &&
-                    (ptr2 = ap_strstr_c(r->filename, "unix:")) &&
-                    (ptr = ap_strchr(r->filename, '|'))) {
+                    (ptr2 = ap_strcasestr(r->filename, "unix:")) &&
+                    (ptr = ap_strchr(ptr2, '|'))) {
                     apr_uri_t urisock;
                     apr_status_t rv;
                     *ptr = '\0';
@@ -1961,6 +1964,9 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
                             "worker uds path (%s) too long", sockpath);
                         }
                         r->filename = ptr+1;    /* so we get the scheme for the uds */
+                        *url = apr_pstrdup(r->pool, r->filename);
+                        ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
+                                      "*: rewrite of url due to UDS: %s", *url);
                     }
                     else {
                         *ptr = '|';