You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2018/02/14 10:50:49 UTC
svn commit: r1824219 - /httpd/httpd/patches/2.4.x/proxy-rfc1035-hostname.diff
Author: minfrin
Date: Wed Feb 14 10:50:48 2018
New Revision: 1824219
URL: http://svn.apache.org/viewvc?rev=1824219&view=rev
Log:
Add 2.4.x patch for http://svn.apache.org/r1824176 backport.
Added:
httpd/httpd/patches/2.4.x/proxy-rfc1035-hostname.diff
Added: httpd/httpd/patches/2.4.x/proxy-rfc1035-hostname.diff
URL: http://svn.apache.org/viewvc/httpd/httpd/patches/2.4.x/proxy-rfc1035-hostname.diff?rev=1824219&view=auto
==============================================================================
--- httpd/httpd/patches/2.4.x/proxy-rfc1035-hostname.diff (added)
+++ httpd/httpd/patches/2.4.x/proxy-rfc1035-hostname.diff Wed Feb 14 10:50:48 2018
@@ -0,0 +1,331 @@
+diff -r -u apache2-2.4.18/modules/proxy/balancers/mod_lbmethod_heartbeat.c apache2-2.4.18-patched/modules/proxy/balancers/mod_lbmethod_heartbeat.c
+--- apache2-2.4.18/modules/proxy/balancers/mod_lbmethod_heartbeat.c 2015-02-24 06:22:22.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/balancers/mod_lbmethod_heartbeat.c 2018-02-13 11:39:57.964057780 +0000
+@@ -300,7 +300,7 @@
+
+ for (i = 0; i < balancer->workers->nelts; i++) {
+ worker = &APR_ARRAY_IDX(balancer->workers, i, proxy_worker *);
+- server = apr_hash_get(servers, (*worker)->s->hostname, APR_HASH_KEY_STRING);
++ server = apr_hash_get(servers, (*worker)->s->hostname_ex, APR_HASH_KEY_STRING);
+
+ if (!server) {
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, APLOGNO(01214)
+diff -r -u apache2-2.4.18/modules/proxy/mod_proxy_ajp.c apache2-2.4.18-patched/modules/proxy/mod_proxy_ajp.c
+--- apache2-2.4.18/modules/proxy/mod_proxy_ajp.c 2015-06-02 13:39:26.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/mod_proxy_ajp.c 2018-02-13 11:39:57.964057780 +0000
+@@ -213,7 +213,7 @@
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00868)
+ "request failed to %pI (%s)",
+ conn->worker->cp->addr,
+- conn->worker->s->hostname);
++ conn->worker->s->hostname_ex);
+ if (status == AJP_EOVERFLOW)
+ return HTTP_BAD_REQUEST;
+ else if (status == AJP_EBAD_METHOD) {
+@@ -297,7 +297,7 @@
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00876)
+ "send failed to %pI (%s)",
+ conn->worker->cp->addr,
+- conn->worker->s->hostname);
++ conn->worker->s->hostname_ex);
+ /*
+ * It is fatal when we failed to send a (part) of the request
+ * body.
+@@ -337,7 +337,7 @@
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00878)
+ "read response failed from %pI (%s)",
+ conn->worker->cp->addr,
+- conn->worker->s->hostname);
++ conn->worker->s->hostname_ex);
+
+ /* If we had a successful cping/cpong and then a timeout
+ * we assume it is a request that cause a back-end timeout,
+@@ -635,7 +635,7 @@
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00892)
+ "got response from %pI (%s)",
+ conn->worker->cp->addr,
+- conn->worker->s->hostname);
++ conn->worker->s->hostname_ex);
+
+ if (conf->error_override && ap_is_HTTP_ERROR(r->status)) {
+ /* clear r->status for override error, otherwise ErrorDocument
+@@ -659,7 +659,7 @@
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00893)
+ "dialog to %pI (%s) failed",
+ conn->worker->cp->addr,
+- conn->worker->s->hostname);
++ conn->worker->s->hostname_ex);
+ /*
+ * If we already send data, signal a broken backend connection
+ * upwards in the chain.
+@@ -791,7 +791,7 @@
+ backend->close = 1;
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(00897)
+ "cping/cpong failed to %pI (%s)",
+- worker->cp->addr, worker->s->hostname);
++ worker->cp->addr, worker->s->hostname_ex);
+ status = HTTP_SERVICE_UNAVAILABLE;
+ retry++;
+ continue;
+diff -r -u apache2-2.4.18/modules/proxy/mod_proxy_balancer.c apache2-2.4.18-patched/modules/proxy/mod_proxy_balancer.c
+--- apache2-2.4.18/modules/proxy/mod_proxy_balancer.c 2015-10-06 12:36:14.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/mod_proxy_balancer.c 2018-02-13 11:39:57.964057780 +0000
+@@ -434,7 +434,7 @@
+ (*worker)->s->status &= ~PROXY_WORKER_IN_ERROR;
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01165)
+ "%s: Forcing recovery for worker (%s)",
+- balancer->s->name, (*worker)->s->hostname);
++ balancer->s->name, (*worker)->s->hostname_ex);
+ }
+ }
+ }
+@@ -1288,7 +1288,7 @@
+ "</httpd:name>\n", NULL);
+ ap_rvputs(r, " <httpd:scheme>", worker->s->scheme,
+ "</httpd:scheme>\n", NULL);
+- ap_rvputs(r, " <httpd:hostname>", worker->s->hostname,
++ ap_rvputs(r, " <httpd:hostname>", worker->s->hostname_ex,
+ "</httpd:hostname>\n", NULL);
+ ap_rprintf(r, " <httpd:loadfactor>%d</httpd:loadfactor>\n",
+ worker->s->lbfactor);
+diff -r -u apache2-2.4.18/modules/proxy/mod_proxy.c apache2-2.4.18-patched/modules/proxy/mod_proxy.c
+--- apache2-2.4.18/modules/proxy/mod_proxy.c 2015-11-26 21:28:55.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/mod_proxy.c 2018-02-13 11:39:57.964057780 +0000
+@@ -2596,7 +2596,7 @@
+ char fbuf[50];
+ if (!(flags & AP_STATUS_SHORT)) {
+ ap_rvputs(r, "<tr>\n<td>", (*worker)->s->scheme, "</td>", NULL);
+- ap_rvputs(r, "<td>", (*worker)->s->hostname, "</td><td>", NULL);
++ ap_rvputs(r, "<td>", (*worker)->s->hostname_ex, "</td><td>", NULL);
+ ap_rvputs(r, ap_proxy_parse_wstatus(r->pool, *worker), NULL);
+ ap_rvputs(r, "</td><td>", (*worker)->s->route, NULL);
+ ap_rvputs(r, "</td><td>", (*worker)->s->redirect, NULL);
+@@ -2688,7 +2688,8 @@
+ ap_proxy_define_worker(p, &forward, NULL, NULL, "http://www.apache.org", 0);
+ conf->forward = forward;
+ PROXY_STRNCPY(conf->forward->s->name, "proxy:forward");
+- PROXY_STRNCPY(conf->forward->s->hostname, "*");
++ PROXY_STRNCPY(conf->forward->s->hostname, "*"); /* for compatibility */
++ PROXY_STRNCPY(conf->forward->s->hostname_ex, "*");
+ PROXY_STRNCPY(conf->forward->s->scheme, "*");
+ conf->forward->hash.def = conf->forward->s->hash.def =
+ ap_proxy_hashfunc(conf->forward->s->name, PROXY_HASHFUNC_DEFAULT);
+@@ -2705,7 +2706,8 @@
+ if (!reverse) {
+ ap_proxy_define_worker(p, &reverse, NULL, NULL, "http://www.apache.org", 0);
+ PROXY_STRNCPY(reverse->s->name, "proxy:reverse");
+- PROXY_STRNCPY(reverse->s->hostname, "*");
++ PROXY_STRNCPY(reverse->s->hostname, "*"); /* for compatibility */
++ PROXY_STRNCPY(reverse->s->hostname_ex, "*");
+ PROXY_STRNCPY(reverse->s->scheme, "*");
+ reverse->hash.def = reverse->s->hash.def =
+ ap_proxy_hashfunc(reverse->s->name, PROXY_HASHFUNC_DEFAULT);
+diff -r -u apache2-2.4.18/modules/proxy/mod_proxy.h apache2-2.4.18-patched/modules/proxy/mod_proxy.h
+--- apache2-2.4.18/modules/proxy/mod_proxy.h 2015-04-15 17:50:46.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/mod_proxy.h 2018-02-13 11:47:47.256757454 +0000
+@@ -323,6 +323,8 @@
+ #define PROXY_BALANCER_MAX_HOSTNAME_SIZE PROXY_WORKER_MAX_HOSTNAME_SIZE
+ #define PROXY_BALANCER_MAX_STICKY_SIZE 64
+
++#define PROXY_RFC1035_HOSTNAME_SIZE 256
++
+ #define PROXY_MAX_PROVIDER_NAME_SIZE 16
+
+ #define PROXY_STRNCPY(dst, src) ap_proxy_strncpy((dst), (src), (sizeof(dst)))
+@@ -347,7 +349,7 @@
+ typedef struct {
+ char name[PROXY_WORKER_MAX_NAME_SIZE];
+ char scheme[PROXY_WORKER_MAX_SCHEME_SIZE]; /* scheme to use ajp|http|https */
+- char hostname[PROXY_WORKER_MAX_HOSTNAME_SIZE]; /* remote backend address */
++ char hostname[PROXY_WORKER_MAX_HOSTNAME_SIZE]; /* remote backend address (deprecated, use hostname_ex below) */
+ char route[PROXY_WORKER_MAX_ROUTE_SIZE]; /* balancing route */
+ char redirect[PROXY_WORKER_MAX_ROUTE_SIZE]; /* temporary balancing redirection route */
+ char flusher[PROXY_WORKER_MAX_SCHEME_SIZE]; /* flush provider used by mod_proxy_fdpass */
+@@ -398,6 +400,7 @@
+ unsigned int keepalive_set:1;
+ unsigned int disablereuse_set:1;
+ unsigned int was_malloced:1;
++ char hostname_ex[PROXY_RFC1035_HOSTNAME_SIZE]; /* RFC1035 compliant version of the remote backend address */
+ } proxy_worker_shared;
+
+ #define ALIGNED_PROXY_WORKER_SHARED_SIZE (APR_ALIGN_DEFAULT(sizeof(proxy_worker_shared)))
+diff -r -u apache2-2.4.18/modules/proxy/mod_proxy_http.c apache2-2.4.18-patched/modules/proxy/mod_proxy_http.c
+--- apache2-2.4.18/modules/proxy/mod_proxy_http.c 2015-09-16 13:34:11.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/mod_proxy_http.c 2018-02-13 11:40:00.448040101 +0000
+@@ -2023,7 +2023,7 @@
+ backend->close = 1;
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, status, r, APLOGNO(01115)
+ "HTTP: 100-Continue failed to %pI (%s)",
+- worker->cp->addr, worker->s->hostname);
++ worker->cp->addr, worker->s->hostname_ex);
+ retry++;
+ continue;
+ } else {
+diff -r -u apache2-2.4.18/modules/proxy/proxy_util.c apache2-2.4.18-patched/modules/proxy/proxy_util.c
+--- apache2-2.4.18/modules/proxy/proxy_util.c 2015-10-08 14:48:31.000000000 +0000
++++ apache2-2.4.18-patched/modules/proxy/proxy_util.c 2018-02-13 11:41:11.067537465 +0000
+@@ -1707,9 +1707,14 @@
+ "Alert! worker name (%s) too long; truncated to: %s", ptr, wshared->name);
+ }
+ if (PROXY_STRNCPY(wshared->scheme, uri.scheme) != APR_SUCCESS) {
+- return apr_psprintf(p, "worker scheme (%s) too long", uri.scheme);
++ ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, APLOGNO(010117)
++ "Alert! worker scheme (%s) too long; truncated to: %s", uri.scheme, wshared->scheme);
+ }
+ if (PROXY_STRNCPY(wshared->hostname, uri.hostname) != APR_SUCCESS) {
++ 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_ex);
++ }
++ if (PROXY_STRNCPY(wshared->hostname_ex, uri.hostname) != APR_SUCCESS) {
+ return apr_psprintf(p, "worker hostname (%s) too long", uri.hostname);
+ }
+ wshared->port = uri.port;
+@@ -1863,7 +1868,7 @@
+
+ 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 */
+@@ -1880,7 +1885,7 @@
+
+ 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);
+
+@@ -1901,13 +1906,13 @@
+ 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;
+ }
+ }
+@@ -2129,7 +2134,7 @@
+ 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;
+ }
+ }
+@@ -2152,12 +2157,12 @@
+ 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;
+@@ -2172,7 +2177,7 @@
+ {
+ 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;
+@@ -2676,7 +2681,7 @@
+ "%s: error creating Unix domain socket for "
+ "target %s",
+ proxy_function,
+- worker->s->hostname);
++ worker->s->hostname_ex);
+ break;
+ }
+ conn->connection = NULL;
+@@ -2689,7 +2694,7 @@
+ "%s (%s) failed",
+ proxy_function,
+ conn->uds_path,
+- worker->s->hostname);
++ worker->s->hostname_ex);
+ break;
+ }
+
+@@ -2698,7 +2703,7 @@
+ "%s (%s)",
+ proxy_function,
+ conn->uds_path,
+- worker->s->hostname);
++ worker->s->hostname_ex);
+ }
+ else
+ #endif
+@@ -2712,7 +2717,7 @@
+ "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
+@@ -2762,7 +2767,7 @@
+ }
+ 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,
+@@ -2787,7 +2792,7 @@
+ "%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;
+ }
+@@ -2796,7 +2801,7 @@
+ "%s: connection established with %pI (%s)",
+ proxy_function,
+ backend_addr,
+- worker->s->hostname);
++ worker->s->hostname_ex);
+ }
+
+ /* Set a timeout on the socket */
+@@ -2830,7 +2835,7 @@
+ "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;
+ }
+@@ -2853,7 +2858,7 @@
+ 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 {
+