From 7651045da69ad96b47349f21faddf2518ed5206a Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Wed, 22 Jan 2014 22:26:49 +0000 Subject: [PATCH] Adjust url as required, following what we did to r->filename. 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 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 79e3070879..1a09ed71ac 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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 = '|'; -- 2.40.0