Backport of:

From 496c863776c68bd08cdbeb7d8fa5935ba63b76c2 Mon Sep 17 00:00:00 2001
From: Yann Ylavic <ylavic@apache.org>
Date: Fri, 3 Sep 2021 16:52:38 +0000
Subject: [PATCH] Merge r1892814, r1892853 from trunk:

mod_proxy: Faster unix socket path parsing in the "proxy:" URL.

The actual r->filename format is "[proxy:]unix:path|url" for UDS, no need to
strstr(,"unix:") since it's at the start of the string.


mod_proxy: Follow up to r1892814.

Save some few cycles in ap_proxy_de_socketfy() too.


Submitted by: ylavic
Reviewed by: ylavic, covener, rpluem


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1892874 13f79535-47bb-0310-9956-ffa450edef68
---
 changes-entries/fix_uds_filename.txt | 2 ++
 modules/proxy/mod_proxy.c            | 2 +-
 modules/proxy/proxy_util.c           | 4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)
 create mode 100644 changes-entries/fix_uds_filename.txt

#--- /dev/null
#+++ b/changes-entries/fix_uds_filename.txt
#@@ -0,0 +1,2 @@
#+  *) mod_proxy: Faster unix socket path parsing in the "proxy:" URL.
#+     [Yann Ylavic]
--- a/modules/proxy/mod_proxy.c
+++ b/modules/proxy/mod_proxy.c
@@ -1577,7 +1577,7 @@ PROXY_DECLARE(const char *) ap_proxy_de_
      * the UDS path... ignore it
      */
     if (!strncasecmp(url, "unix:", 5) &&
-        ((ptr = ap_strchr_c(url, '|')) != NULL)) {
+        ((ptr = ap_strchr_c(url + 5, '|')) != NULL)) {
         /* move past the 'unix:...|' UDS path info */
         const char *ret, *c;
 
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -1944,8 +1944,8 @@ static void fix_uds_filename(request_rec
     if (!r || !r->filename) return;
 
     if (!strncmp(r->filename, "proxy:", 6) &&
-            (ptr2 = ap_strcasestr(r->filename, "unix:")) &&
-            (ptr = ap_strchr(ptr2, '|'))) {
+            !ap_cstr_casecmpn(r->filename + 6, "unix:", 5) &&
+            (ptr2 = r->filename + 6 + 5, ptr = ap_strchr(ptr2, '|'))) {
         apr_uri_t urisock;
         apr_status_t rv;
         *ptr = '\0';
