]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1892814, r1892853 from trunk:
authorYann Ylavic <ylavic@apache.org>
Fri, 3 Sep 2021 16:52:38 +0000 (16:52 +0000)
committerYann Ylavic <ylavic@apache.org>
Fri, 3 Sep 2021 16:52:38 +0000 (16:52 +0000)
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 [new file with mode: 0644]
modules/proxy/mod_proxy.c
modules/proxy/proxy_util.c

diff --git a/changes-entries/fix_uds_filename.txt b/changes-entries/fix_uds_filename.txt
new file mode 100644 (file)
index 0000000..d6c3471
--- /dev/null
@@ -0,0 +1,2 @@
+  *) mod_proxy: Faster unix socket path parsing in the "proxy:" URL.
+     [Yann Ylavic]
index 60634d344c7f0c2fbaacb7226083f03417aa1b73..354bb8f660f9421cd7949de70f2788e0a4654b7b 100644 (file)
@@ -1975,7 +1975,7 @@ PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url)
      * the UDS path... ignore it
      */
     if (!ap_cstr_casecmpn(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;
 
index 3c4ea72aba7814b9123f346c7c10be6b7ec4b39a..812c32f35842e9ee8c6f4601d19d56599ca38b41 100644 (file)
@@ -2281,8 +2281,8 @@ static void fix_uds_filename(request_rec *r, char **url)
     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';