]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy: Allow for empty UDS URL hostname in ProxyPass workers too.
authorYann Ylavic <ylavic@apache.org>
Fri, 26 Jul 2024 14:40:44 +0000 (14:40 +0000)
committerYann Ylavic <ylavic@apache.org>
Fri, 26 Jul 2024 14:40:44 +0000 (14:40 +0000)
Using "unix:/udspath|scheme:" or "unix:/udspath|scheme://" for a ProxyPass URL
does not work currently, while it works for SetHandler "proxy:unix:...".

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1919533 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy.c
modules/proxy/proxy_util.c

index f0b73fa1e0b71cdc2b6c211303dcf3ac9e34a177..0b6be1a1b02e2322c5705c7359ea3aec01580b4c 100644 (file)
@@ -1968,9 +1968,9 @@ PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url)
         const char *ret, *c;
 
         ret = ptr + 1;
-        /* special case: "unix:....|scheme:" is OK, expand
-         * to "unix:....|scheme://localhost"
-         * */
+        /* special cases: "unix:...|scheme:" ind "unix:...|scheme://" are OK,
+         * expand to "unix:....|scheme://localhost"
+         */
         c = ap_strchr_c(ret, ':');
         if (c == NULL) {
             return NULL;
@@ -1978,6 +1978,9 @@ PROXY_DECLARE(const char *) ap_proxy_de_socketfy(apr_pool_t *p, const char *url)
         if (c[1] == '\0') {
             return apr_pstrcat(p, ret, "//localhost", NULL);
         }
+        else if (c[1] == '/' && c[2] == '/' && !c[3]) {
+            return apr_pstrcat(p, ret, "localhost", NULL);
+        }
         else {
             return ret;
         }
index ae964eb930f9d1e6e7e939cdcac93085c8078f4b..558af5cfab3609dcec76ab8661f5cfc324074ea8 100644 (file)
@@ -1978,7 +1978,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker_ex(apr_pool_t *p,
             && (ptr = ap_strchr_c(url + 5, '|'))) {
         rv = apr_uri_parse(p, apr_pstrmemdup(p, url, ptr - url), &uri);
         if (rv == APR_SUCCESS) {
-            sockpath = ap_runtime_dir_relative(p, uri.path);;
+            sockpath = ap_runtime_dir_relative(p, uri.path);
             ptr++;    /* so we get the scheme for the uds */
         }
         else {
@@ -2044,7 +2044,7 @@ PROXY_DECLARE(char *) ap_proxy_define_worker_ex(apr_pool_t *p,
     if (!uri.scheme) {
         return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);
     }
-    if (!uri.hostname) {
+    if (!uri.hostname || !*uri.hostname) {
         if (sockpath) {
             /* allow for unix:/path|http: */
             uri.hostname = "localhost";