Mailing List Archive

svn commit: r1893519 - in /httpd/httpd/trunk: changes-entries/uds_empty_hostname.txt modules/proxy/proxy_util.c
Author: ylavic
Date: Wed Sep 22 18:47:09 2021
New Revision: 1893519

URL: http://svn.apache.org/viewvc?rev=1893519&view=rev
Log:
mod_proxy: Handle UDS URIs with empty hostname as if they had no hostname.

It was reported to me (privately) that r1893101 broke existing settings like:
SetHandler "proxy:unix:///path/to/uds.sock|fcgi://localhost/"

RFC 3986 (section 3.2.2) says that:
If the URI scheme defines a default for host, then that default
applies when the host subcomponent is undefined or when the
registered name is empty (zero length). For example, the "file" URI
scheme is defined so that no authority, an empty host, and
"localhost" all mean the end-user's machine, whereas the "http"
scheme considers a missing authority or empty host invalid.

Let's consider that the "unix" scheme is closer to the "file" scheme than
the "http" one, and accept "unix:///path/to/uds.sock" as a valid URI.


Added:
httpd/httpd/trunk/changes-entries/uds_empty_hostname.txt
Modified:
httpd/httpd/trunk/modules/proxy/proxy_util.c

Added: httpd/httpd/trunk/changes-entries/uds_empty_hostname.txt
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/changes-entries/uds_empty_hostname.txt?rev=1893519&view=auto
==============================================================================
--- httpd/httpd/trunk/changes-entries/uds_empty_hostname.txt (added)
+++ httpd/httpd/trunk/changes-entries/uds_empty_hostname.txt Wed Sep 22 18:47:09 2021
@@ -0,0 +1,2 @@
+ *) mod_proxy: Handle UDS URIs with empty hostname ("unix:///...") as if they
+ had no hostname ("unix:/..."). [Yann Ylavic]
\ No newline at end of file

Modified: httpd/httpd/trunk/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/proxy_util.c?rev=1893519&r1=1893518&r2=1893519&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/trunk/modules/proxy/proxy_util.c Wed Sep 22 18:47:09 2021
@@ -2284,7 +2284,8 @@ static int fix_uds_filename(request_rec
rv = apr_uri_parse(r->pool, uds_url, &urisock);
*origin_url++ = '|';

- if (rv == APR_SUCCESS && urisock.path && !urisock.hostname) {
+ if (rv == APR_SUCCESS && urisock.path && (!urisock.hostname
+ || !urisock.hostname[0])) {
uds_path = ap_runtime_dir_relative(r->pool, urisock.path);
}
if (!uds_path) {