]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
ap_proxy_define_match_worker: don't copy the url unnecessarily.
authorYann Ylavic <ylavic@apache.org>
Fri, 19 Jun 2020 15:39:33 +0000 (15:39 +0000)
committerYann Ylavic <ylavic@apache.org>
Fri, 19 Jun 2020 15:39:33 +0000 (15:39 +0000)
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

modules/proxy/proxy_util.c

index 1597b9f211bf130a963b95601f2ec6ff482007f8..59b77aa7c3233a26257f24333e298f79efc556e1 100644 (file)
@@ -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;
     }