You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2020/06/19 15:39:33 UTC

svn commit: r1878994 - /httpd/httpd/trunk/modules/proxy/proxy_util.c

Author: ylavic
Date: Fri Jun 19 15:39:33 2020
New Revision: 1878994

URL: http://svn.apache.org/viewvc?rev=1878994&view=rev
Log:
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.

Modified:
    httpd/httpd/trunk/modules/proxy/proxy_util.c

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1878994&r1=1878993&r2=1878994&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Fri Jun 19 15:39:33 2020
@@ -1951,12 +1951,12 @@ PROXY_DECLARE(char *) ap_proxy_define_ma
                                              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;
     }