diff options
author | Yann Ylavic <ylavic@apache.org> | 2024-07-26 16:40:44 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2024-07-26 16:40:44 +0200 |
commit | 3ce4c8cdf8c42dcc25095186a0c6cf3481cc56dc (patch) | |
tree | 9b6ddf5c136bf9e06afe17b4784534c6c764c67c /modules | |
parent | *) mod_proxy: Avoid AH01059 parsing error for SetHandler "unix:" URLs (diff) | |
download | apache2-3ce4c8cdf8c42dcc25095186a0c6cf3481cc56dc.tar.xz apache2-3ce4c8cdf8c42dcc25095186a0c6cf3481cc56dc.zip |
mod_proxy: Allow for empty UDS URL hostname in ProxyPass workers too.
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
Diffstat (limited to 'modules')
-rw-r--r-- | modules/proxy/mod_proxy.c | 9 | ||||
-rw-r--r-- | modules/proxy/proxy_util.c | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index f0b73fa1e0..0b6be1a1b0 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -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; } diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index ae964eb930..558af5cfab 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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"; |