ap_escape_uri(r->pool, worker->s->name),
"&nonce=", balancer->s->nonce,
"\">", NULL);
- ap_rvputs(r, (worker->s->uds ? "<i>" : ""), ap_proxy_worker_name(r->pool, worker),
- (worker->s->uds ? "</i>" : ""), "</a></td>", NULL);
+ ap_rvputs(r, (*worker->s->uds_path ? "<i>" : ""), ap_proxy_worker_name(r->pool, worker),
+ (*worker->s->uds_path ? "</i>" : ""), "</a></td>", NULL);
ap_rvputs(r, "<td>", ap_escape_html(r->pool, worker->s->route),
NULL);
ap_rvputs(r, "</td><td>",
ap_rputs("<hr />\n", r);
if (wsel && bsel) {
ap_rputs("<h3>Edit worker settings for ", r);
- ap_rvputs(r, (wsel->s->uds?"<i>":""), ap_proxy_worker_name(r->pool, wsel), (wsel->s->uds?"</i>":""), "</h3>\n", NULL);
+ ap_rvputs(r, (*wsel->s->uds_path?"<i>":""), ap_proxy_worker_name(r->pool, wsel), (*wsel->s->uds_path?"</i>":""), "</h3>\n", NULL);
ap_rputs("<form method=\"POST\" enctype=\"application/x-www-form-urlencoded\" action=\"", r);
ap_rvputs(r, ap_escape_uri(r->pool, action), "\">\n", NULL);
ap_rputs("<dl>\n<table><tr><td>Load factor:</td><td><input name='w_lf' id='w_lf' type=text ", r);
int rv;
apr_uri_t uri;
apr_pool_t *pool = p;
- if (!worker->s->uds) {
+ if (!(*worker->s->uds_path)) {
return worker->s->name;
}
if (!pool) {
return worker->s->name;
}
}
- rv = apr_uri_parse(pool, worker->s->name, &uri);
- if (rv != APR_SUCCESS) {
- return apr_pstrcat(pool, worker->s->name, "|", NULL);
- }
- return apr_pstrcat(pool, "unix:", uri.path, "|", uri.scheme, ":", NULL);
+ return apr_pstrcat(pool, "unix:", worker->s->uds_path, "|", worker->s->name, NULL);
}
PROXY_DECLARE(proxy_worker *) ap_proxy_get_worker(apr_pool_t *p,
proxy_worker_shared *wshared;
char *ptr, *sockpath = NULL;
- /* Look to see if we are using UDS:
- require format: unix:/path/foo/bar.sock|http:
- This results in talking http to the socket at /path/foo/bar.sock
- */
+ /*
+ * Look to see if we are using UDS:
+ * require format: unix:/path/foo/bar.sock|http://ignored/path2/
+ * 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, url, &urisock);
if (rv == APR_SUCCESS && !strcasecmp(urisock.scheme, "unix")) {
- sockpath = urisock.path;
+ sockpath = ap_runtime_dir_relative(p, urisock.path);;
url = ptr+1; /* so we get the scheme for the uds */
}
else {
if (!uri.scheme) {
return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);
}
- /* allow for http:|sock:/path */
+ /* allow for unix:/path|http: */
if (!uri.hostname && !sockpath) {
return apr_pstrcat(p, "URL must be absolute!: ", url, NULL);;
}
if (sockpath) {
uri.hostname = "localhost";
- uri.path = ap_runtime_dir_relative(p, sockpath);
- uri.query = NULL;
- uri.fragment = NULL;
}
else {
ap_str_tolower(uri.hostname);
wshared->hash.def = ap_proxy_hashfunc(wshared->name, PROXY_HASHFUNC_DEFAULT);
wshared->hash.fnv = ap_proxy_hashfunc(wshared->name, PROXY_HASHFUNC_FNV);
wshared->was_malloced = (do_malloc != 0);
- wshared->uds = (sockpath != NULL);
+ if (sockpath) {
+ if (PROXY_STRNCPY(wshared->uds_path, sockpath) != APR_SUCCESS) {
+ return apr_psprintf(p, "worker uds path (%s) too long", sockpath);
+ }
+
+ }
+ else {
+ *wshared->uds_path = '\0';
+ }
(*worker)->hash = wshared->hash;
(*worker)->context = NULL;
(*conn)->close = 0;
(*conn)->inreslist = 0;
- if (worker->s->uds) {
+ if (*worker->s->uds_path) {
if ((*conn)->uds_path == NULL) {
- apr_uri_t puri;
- if (apr_uri_parse(worker->cp->pool, worker->s->name, &puri) == APR_SUCCESS) {
- (*conn)->uds_path = apr_pstrdup(worker->cp->pool, puri.path);
- }
+ (*conn)->uds_path = apr_pstrdup(worker->cp->pool, worker->s->uds_path);
}
if ((*conn)->uds_path) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02545)
proxy_function, (*conn)->uds_path);
}
else {
+ /* should never happen */
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(02546)
- "%s: cannot parse for UDS (%s)",
- proxy_function, worker->s->name);
+ "%s: cannot determine UDS (%s)",
+ proxy_function, worker->s->uds_path);
}
}
* spilling the cached addr from the worker.
*/
if (!conn->hostname || !worker->s->is_address_reusable ||
- worker->s->disablereuse || worker->s->uds) {
+ worker->s->disablereuse || *worker->s->uds_path) {
if (proxyname) {
conn->hostname = apr_pstrdup(conn->pool, proxyname);
conn->port = proxyport;
conn->port = uri->port;
}
socket_cleanup(conn);
- if (!worker->s->uds && worker->s->is_address_reusable && !worker->s->disablereuse) {
+ if (!(*worker->s->uds_path) && worker->s->is_address_reusable && !worker->s->disablereuse) {
/*
* Only do a lookup if we should not reuse the backend address.
* Otherwise we will look it up once for the worker.
conn->pool);
}
}
- if (!worker->s->uds && worker->s->is_address_reusable && !worker->s->disablereuse) {
+ if (!(*worker->s->uds_path) && worker->s->is_address_reusable && !worker->s->disablereuse) {
/*
* Looking up the backend address for the worker only makes sense if
* we can reuse the address.