summaryrefslogtreecommitdiffstats
path: root/modules/proxy/proxy_util.c
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2020-06-19 17:39:33 +0200
committerYann Ylavic <ylavic@apache.org>2020-06-19 17:39:33 +0200
commitdb6c2c21c1729b4afd9a5385015510ff1214399e (patch)
treeb44988e1602fa0bde2b3e38c8ffab1570d0c5de5 /modules/proxy/proxy_util.c
parentFor diagnosing weird non-x86 failures, dump /etc/hosts in future runs. [skip ci] (diff)
downloadapache2-db6c2c21c1729b4afd9a5385015510ff1214399e.tar.xz
apache2-db6c2c21c1729b4afd9a5385015510ff1214399e.zip
ap_proxy_define_match_worker: don't copy the url unnecessarily.
And save a few cycles, when the duplication is needed, by not copying the ignored part. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1878994 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--modules/proxy/proxy_util.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index 1597b9f211..59b77aa7c3 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -1951,12 +1951,12 @@ PROXY_DECLARE(char *) ap_proxy_define_match_worker(apr_pool_t *p,
int do_malloc)
{
char *err;
- char *rurl = apr_pstrdup(p, url);
- char *pdollar = ap_strchr(rurl, '$');
+ const char *pdollar = ap_strchr_c(url, '$');
- if (pdollar != NULL)
- *pdollar = '\0';
- err = ap_proxy_define_worker(p, worker, balancer, conf, rurl, do_malloc);
+ if (pdollar != NULL) {
+ url = apr_pstrmemdup(p, url, pdollar - url);
+ }
+ err = ap_proxy_define_worker(p, worker, balancer, conf, url, do_malloc);
if (err) {
return err;
}