From: Jim Jagielski Date: Wed, 22 Jan 2014 22:26:49 +0000 (+0000) Subject: Adjust url as required, following what we did to r->filename. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f08adf0a37fc3ffe44a8d3b98fdb1bcadb992fa;p=thirdparty%2Fapache%2Fhttpd.git 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 --- diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 79e30708799..1a09ed71ac2 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 = '|';