1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

mod_proxy: Provide an RFC1035 compliant version of the hostname in the

proxy_worker_shared structure. PR62085


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1824176 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Graham Leggett
2018-02-13 21:22:05 +00:00
parent 965dae9007
commit fac7f995b0
9 changed files with 52 additions and 40 deletions

View File

@@ -1731,6 +1731,9 @@ PROXY_DECLARE(char *) ap_proxy_define_worker(apr_pool_t *p,
ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, APLOGNO(010118)
"Alert! worker hostname (%s) too long; truncated to: %s", uri.hostname, wshared->hostname);
}
if (PROXY_STRNCPY(wshared->hostname_ex, uri.hostname) != APR_SUCCESS) {
return apr_psprintf(p, "worker hostname (%s) too long", uri.hostname);
}
wshared->flush_packets = flush_off;
wshared->flush_wait = PROXY_FLUSH_WAIT;
wshared->is_address_reusable = 1;
@@ -1921,7 +1924,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00930)
"initialized pool in child %" APR_PID_T_FMT " for (%s) min=%d max=%d smax=%d",
getpid(), worker->s->hostname, worker->s->min,
getpid(), worker->s->hostname_ex, worker->s->min,
worker->s->hmax, worker->s->smax);
/* Set the acquire timeout */
@@ -1938,7 +1941,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00931)
"initialized single connection worker in child %" APR_PID_T_FMT " for (%s)",
getpid(), worker->s->hostname);
getpid(), worker->s->hostname_ex);
}
apr_global_mutex_unlock(proxy_mutex);
@@ -1957,7 +1960,7 @@ static int ap_proxy_retry_worker(const char *proxy_function, proxy_worker *worke
if (PROXY_WORKER_IS(worker, PROXY_WORKER_STOPPED)) {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(3305)
"%s: Won't retry worker (%s): stopped",
proxy_function, worker->s->hostname);
proxy_function, worker->s->hostname_ex);
return DECLINED;
}
if ((worker->s->status & PROXY_WORKER_IGNORE_ERRORS)
@@ -1966,13 +1969,13 @@ static int ap_proxy_retry_worker(const char *proxy_function, proxy_worker *worke
worker->s->status &= ~PROXY_WORKER_IN_ERROR;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00932)
"%s: worker for (%s) has been marked for retry",
proxy_function, worker->s->hostname);
proxy_function, worker->s->hostname_ex);
return OK;
}
else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00933)
"%s: too soon to retry worker for (%s)",
proxy_function, worker->s->hostname);
proxy_function, worker->s->hostname_ex);
return DECLINED;
}
}
@@ -2194,7 +2197,7 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
if (!PROXY_WORKER_IS_USABLE(worker)) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00940)
"%s: disabled connection for (%s)",
proxy_function, worker->s->hostname);
proxy_function, worker->s->hostname_ex);
return HTTP_SERVICE_UNAVAILABLE;
}
}
@@ -2217,12 +2220,12 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
if (rv != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, APLOGNO(00941)
"%s: failed to acquire connection for (%s)",
proxy_function, worker->s->hostname);
proxy_function, worker->s->hostname_ex);
return HTTP_SERVICE_UNAVAILABLE;
}
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00942)
"%s: has acquired connection for (%s)",
proxy_function, worker->s->hostname);
proxy_function, worker->s->hostname_ex);
(*conn)->worker = worker;
(*conn)->close = 0;
@@ -2237,7 +2240,7 @@ PROXY_DECLARE(int) ap_proxy_release_connection(const char *proxy_function,
{
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00943)
"%s: has released connection for (%s)",
proxy_function, conn->worker->s->hostname);
proxy_function, conn->worker->s->hostname_ex);
connection_cleanup(conn);
return OK;
@@ -2833,7 +2836,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"%s: error creating Unix domain socket for "
"target %s",
proxy_function,
worker->s->hostname);
worker->s->hostname_ex);
break;
}
conn->connection = NULL;
@@ -2846,7 +2849,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"%s (%s) failed",
proxy_function,
conn->uds_path,
worker->s->hostname);
worker->s->hostname_ex);
break;
}
@@ -2855,7 +2858,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"%s (%s)",
proxy_function,
conn->uds_path,
worker->s->hostname);
worker->s->hostname_ex);
}
else
#endif
@@ -2869,7 +2872,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"target %s",
proxy_function,
backend_addr->family,
worker->s->hostname);
worker->s->hostname_ex);
/*
* this could be an IPv6 address from the DNS but the
* local machine won't give us an IPv6 socket; hopefully the
@@ -2919,7 +2922,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
}
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, s,
"%s: fam %d socket created to connect to %s",
proxy_function, backend_addr->family, worker->s->hostname);
proxy_function, backend_addr->family, worker->s->hostname_ex);
if (conf->source_address_set) {
local_addr = apr_pmemdup(conn->scpool, conf->source_address,
@@ -2944,7 +2947,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"%s: attempt to connect to %pI (%s) failed",
proxy_function,
backend_addr,
worker->s->hostname);
worker->s->hostname_ex);
backend_addr = backend_addr->next;
continue;
}
@@ -2953,7 +2956,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"%s: connection established with %pI (%s)",
proxy_function,
backend_addr,
worker->s->hostname);
worker->s->hostname_ex);
}
/* Set a timeout on the socket */
@@ -2987,7 +2990,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
"via http CONNECT through %pI (%s) failed",
proxy_function,
forward->target_host, forward->target_port,
backend_addr, worker->s->hostname);
backend_addr, worker->s->hostname_ex);
backend_addr = backend_addr->next;
continue;
}
@@ -3009,7 +3012,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(00959)
"ap_proxy_connect_backend disabling worker for (%s) for %"
APR_TIME_T_FMT "s",
worker->s->hostname, apr_time_sec(worker->s->retry));
worker->s->hostname_ex, apr_time_sec(worker->s->retry));
}
}
else {