From 9b6fb3d615aeeffe51f33ce474dc71b6a850a524 Mon Sep 17 00:00:00 2001
From: Jim Jagielski Support for using a Unix Domain Socket is available by using a target
- which appends |sock:/path/lis.sock
. For example, to proxy
+ which prepends unix:/path/lis.sock|
. For example, to proxy
HTTP and target the UDS at /home/www/socket you would use
- http://localhost/|sock:/home/www.socket
.unix:/home/www.socket|http://localhost/
.
http://localhost/
in the above
- example) is ignored; the path associated with the sock:
+ associated with the 2nd URL (http://localhost/
in the above
+ example) is ignored; only the scheme is significant.
+ The path associated with the unix:
URL is Suppose the local server has address http://example.com/
;
diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c
index a02af850e8..1b7fbd3377 100644
--- a/modules/proxy/proxy_util.c
+++ b/modules/proxy/proxy_util.c
@@ -1508,7 +1508,7 @@ PROXY_DECLARE(char *) ap_proxy_worker_name(apr_pool_t *p,
if (rv != APR_SUCCESS) {
return apr_pstrcat(pool, worker->s->name, "|", NULL);
}
- return apr_pstrcat(pool, uri.scheme, "://localhost/|sock:", uri.path, NULL);
+ return apr_pstrcat(pool, "unix:", uri.path, "|", uri.scheme, ":", NULL);
}
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
@@ -1610,15 +1610,16 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
char *ptr, *sockpath = NULL;
/* Look to see if we are using UDS:
- require format: http://ignored/ignored|sock:/path/foo/bar.sock
+ require format: unix:/path/foo/bar.sock|http:
This results in talking http to the socket at /path/foo/bar.sock
*/
ptr = ap_strchr((char *)url, '|');
if (ptr) {
*ptr = '\0';
- rv = apr_uri_parse(p, ptr+1, &urisock);
- if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "sock")) {
+ rv = apr_uri_parse(p, url, &urisock);
+ if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "unix")) {
sockpath = urisock.path;
+ url = ptr+1; /* so we get the scheme for the uds */
}
else {
*ptr = '|';
@@ -1627,14 +1628,14 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
rv = apr_uri_parse(p, url, &uri);
if (rv != APR_SUCCESS) {
- return "Unable to parse URL";
+ return apr_pstrcat(p, "Unable to parse URL: ", url, NULL);
}
if (!uri.scheme) {
- return "URL must be absolute!";
+ return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);
}
/* allow for http:|sock:/path */
if (!uri.hostname && !sockpath) {
- return "URL must be absolute!";
+ return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);;
}
if (sockpath) {
--
2.40.0