mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
great proxy logging cleanup:
* remove "proxy:", "FCGI", etc. prefixes and pid which are now included in the error log format * propagate frontend request's logconfig to backend request * use ap_log_rerror where possible * remove obsolete APLOG_NOERRNO git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1203859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -904,7 +904,7 @@ static int proxy_handler(request_rec *r)
|
|||||||
"TRACE forbidden by server configuration");
|
"TRACE forbidden by server configuration");
|
||||||
apr_table_setn(r->notes, "verbose-error-to", "*");
|
apr_table_setn(r->notes, "verbose-error-to", "*");
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: TRACE forbidden by server configuration");
|
"TRACE forbidden by server configuration");
|
||||||
return HTTP_METHOD_NOT_ALLOWED;
|
return HTTP_METHOD_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -922,7 +922,7 @@ static int proxy_handler(request_rec *r)
|
|||||||
"TRACE with request body is not allowed");
|
"TRACE with request body is not allowed");
|
||||||
apr_table_setn(r->notes, "verbose-error-to", "*");
|
apr_table_setn(r->notes, "verbose-error-to", "*");
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: TRACE with request body is not allowed");
|
"TRACE with request body is not allowed");
|
||||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -996,8 +996,8 @@ static int proxy_handler(request_rec *r)
|
|||||||
strlen(ents[i].scheme)) == 0)) {
|
strlen(ents[i].scheme)) == 0)) {
|
||||||
|
|
||||||
/* handle the scheme */
|
/* handle the scheme */
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"Trying to run scheme_handler against proxy");
|
"Trying to run scheme_handler against proxy");
|
||||||
access_status = proxy_run_scheme_handler(r, worker,
|
access_status = proxy_run_scheme_handler(r, worker,
|
||||||
conf, url,
|
conf, url,
|
||||||
ents[i].hostname,
|
ents[i].hostname,
|
||||||
@@ -1048,9 +1048,9 @@ static int proxy_handler(request_rec *r)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* handle the scheme */
|
/* handle the scheme */
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"Running scheme %s handler (attempt %d)",
|
"Running scheme %s handler (attempt %d)",
|
||||||
scheme, attempts);
|
scheme, attempts);
|
||||||
AP_PROXY_RUN(r, worker, conf, url, attempts);
|
AP_PROXY_RUN(r, worker, conf, url, attempts);
|
||||||
access_status = proxy_run_scheme_handler(r, worker, conf,
|
access_status = proxy_run_scheme_handler(r, worker, conf,
|
||||||
url, NULL, 0);
|
url, NULL, 0);
|
||||||
@@ -1090,11 +1090,11 @@ static int proxy_handler(request_rec *r)
|
|||||||
max_attempts > attempts++);
|
max_attempts > attempts++);
|
||||||
|
|
||||||
if (DECLINED == access_status) {
|
if (DECLINED == access_status) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: No protocol handler was valid for the URL %s. "
|
"No protocol handler was valid for the URL %s. "
|
||||||
"If you are using a DSO version of mod_proxy, make sure "
|
"If you are using a DSO version of mod_proxy, make sure "
|
||||||
"the proxy submodules are included in the configuration "
|
"the proxy submodules are included in the configuration "
|
||||||
"using LoadModule.", r->uri);
|
"using LoadModule.", r->uri);
|
||||||
access_status = HTTP_INTERNAL_SERVER_ERROR;
|
access_status = HTTP_INTERNAL_SERVER_ERROR;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ static int proxy_ajp_canon(request_rec *r, char *url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
||||||
"proxy: AJP: canonicalising URL %s", url);
|
"AJP: canonicalising URL %s", url);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do syntactic check.
|
* do syntactic check.
|
||||||
@@ -211,7 +211,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
conn->close++;
|
conn->close++;
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: AJP: request failed to %pI (%s)",
|
"AJP: request failed to %pI (%s)",
|
||||||
conn->worker->cp->addr,
|
conn->worker->cp->addr,
|
||||||
conn->worker->s->hostname);
|
conn->worker->s->hostname);
|
||||||
if (status == AJP_EOVERFLOW)
|
if (status == AJP_EOVERFLOW)
|
||||||
@@ -238,7 +238,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
/* We had a failure: Close connection to backend */
|
/* We had a failure: Close connection to backend */
|
||||||
conn->close++;
|
conn->close++;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: ajp_alloc_data_msg failed");
|
"ajp_alloc_data_msg failed");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
if (tenc && (strcasecmp(tenc, "chunked") == 0)) {
|
if (tenc && (strcasecmp(tenc, "chunked") == 0)) {
|
||||||
/* The AJP protocol does not want body data yet */
|
/* The AJP protocol does not want body data yet */
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: request is chunked");
|
"request is chunked");
|
||||||
} else {
|
} else {
|
||||||
/* Get client provided Content-Length header */
|
/* Get client provided Content-Length header */
|
||||||
content_length = get_content_length(r);
|
content_length = get_content_length(r);
|
||||||
@@ -260,7 +260,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
/* We had a failure: Close connection to backend */
|
/* We had a failure: Close connection to backend */
|
||||||
conn->close++;
|
conn->close++;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: ap_get_brigade failed");
|
"ap_get_brigade failed");
|
||||||
apr_brigade_destroy(input_brigade);
|
apr_brigade_destroy(input_brigade);
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
@@ -268,12 +268,12 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
/* have something */
|
/* have something */
|
||||||
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {
|
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: APR_BUCKET_IS_EOS");
|
"APR_BUCKET_IS_EOS");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to send something */
|
/* Try to send something */
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: data to read (max %" APR_SIZE_T_FMT
|
"data to read (max %" APR_SIZE_T_FMT
|
||||||
" at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos);
|
" at %" APR_SIZE_T_FMT ")", bufsiz, msg->pos);
|
||||||
|
|
||||||
status = apr_brigade_flatten(input_brigade, buff, &bufsiz);
|
status = apr_brigade_flatten(input_brigade, buff, &bufsiz);
|
||||||
@@ -282,13 +282,13 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
conn->close++;
|
conn->close++;
|
||||||
apr_brigade_destroy(input_brigade);
|
apr_brigade_destroy(input_brigade);
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: apr_brigade_flatten");
|
"apr_brigade_flatten");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
apr_brigade_cleanup(input_brigade);
|
apr_brigade_cleanup(input_brigade);
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: got %" APR_SIZE_T_FMT " bytes of data", bufsiz);
|
"got %" APR_SIZE_T_FMT " bytes of data", bufsiz);
|
||||||
if (bufsiz > 0) {
|
if (bufsiz > 0) {
|
||||||
status = ajp_send_data_msg(conn->sock, msg, bufsiz);
|
status = ajp_send_data_msg(conn->sock, msg, bufsiz);
|
||||||
ajp_msg_log(r, msg, "First ajp_send_data_msg: ajp_ilink_send packet dump");
|
ajp_msg_log(r, msg, "First ajp_send_data_msg: ajp_ilink_send packet dump");
|
||||||
@@ -297,7 +297,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
conn->close++;
|
conn->close++;
|
||||||
apr_brigade_destroy(input_brigade);
|
apr_brigade_destroy(input_brigade);
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: send failed to %pI (%s)",
|
"send failed to %pI (%s)",
|
||||||
conn->worker->cp->addr,
|
conn->worker->cp->addr,
|
||||||
conn->worker->s->hostname);
|
conn->worker->s->hostname);
|
||||||
/*
|
/*
|
||||||
@@ -311,7 +311,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
}
|
}
|
||||||
else if (content_length > 0) {
|
else if (content_length > 0) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: read zero bytes, expecting"
|
"read zero bytes, expecting"
|
||||||
" %" APR_OFF_T_FMT " bytes",
|
" %" APR_OFF_T_FMT " bytes",
|
||||||
content_length);
|
content_length);
|
||||||
/*
|
/*
|
||||||
@@ -337,7 +337,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
conn->close++;
|
conn->close++;
|
||||||
apr_brigade_destroy(input_brigade);
|
apr_brigade_destroy(input_brigade);
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: read response failed from %pI (%s)",
|
"read response failed from %pI (%s)",
|
||||||
conn->worker->cp->addr,
|
conn->worker->cp->addr,
|
||||||
conn->worker->s->hostname);
|
conn->worker->s->hostname);
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
bufsiz = 0;
|
bufsiz = 0;
|
||||||
havebody = 0;
|
havebody = 0;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server,
|
||||||
"proxy: APR_BUCKET_IS_EOS");
|
"APR_BUCKET_IS_EOS");
|
||||||
} else {
|
} else {
|
||||||
status = ap_get_brigade(r->input_filters, input_brigade,
|
status = ap_get_brigade(r->input_filters, input_brigade,
|
||||||
AP_MODE_READBYTES,
|
AP_MODE_READBYTES,
|
||||||
@@ -438,7 +438,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
*/
|
*/
|
||||||
backend_failed = 1;
|
backend_failed = 1;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: Backend sent headers twice.");
|
"Backend sent headers twice.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* AJP13_SEND_HEADERS: process them */
|
/* AJP13_SEND_HEADERS: process them */
|
||||||
@@ -515,7 +515,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
if (ap_pass_brigade(r->output_filters,
|
if (ap_pass_brigade(r->output_filters,
|
||||||
output_brigade) != APR_SUCCESS) {
|
output_brigade) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: error processing body.%s",
|
"error processing body.%s",
|
||||||
r->connection->aborted ?
|
r->connection->aborted ?
|
||||||
" Client aborted connection." : "");
|
" Client aborted connection." : "");
|
||||||
output_failed = 1;
|
output_failed = 1;
|
||||||
@@ -544,7 +544,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
if (ap_pass_brigade(r->output_filters,
|
if (ap_pass_brigade(r->output_filters,
|
||||||
output_brigade) != APR_SUCCESS) {
|
output_brigade) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: error processing end");
|
"error processing end");
|
||||||
output_failed = 1;
|
output_failed = 1;
|
||||||
}
|
}
|
||||||
/* XXX: what about flush here? See mod_jk */
|
/* XXX: what about flush here? See mod_jk */
|
||||||
@@ -599,7 +599,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
|
|
||||||
if (backend_failed || output_failed) {
|
if (backend_failed || output_failed) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: Processing of request failed backend: %i, "
|
"Processing of request failed backend: %i, "
|
||||||
"output: %i", backend_failed, output_failed);
|
"output: %i", backend_failed, output_failed);
|
||||||
/* We had a failure: Close connection to backend */
|
/* We had a failure: Close connection to backend */
|
||||||
conn->close++;
|
conn->close++;
|
||||||
@@ -610,7 +610,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
}
|
}
|
||||||
else if (!request_ended) {
|
else if (!request_ended) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: Processing of request didn't terminate cleanly");
|
"Processing of request didn't terminate cleanly");
|
||||||
/* We had a failure: Close connection to backend */
|
/* We had a failure: Close connection to backend */
|
||||||
conn->close++;
|
conn->close++;
|
||||||
backend_failed = 1;
|
backend_failed = 1;
|
||||||
@@ -625,7 +625,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: got response from %pI (%s)",
|
"got response from %pI (%s)",
|
||||||
conn->worker->cp->addr,
|
conn->worker->cp->addr,
|
||||||
conn->worker->s->hostname);
|
conn->worker->s->hostname);
|
||||||
|
|
||||||
@@ -644,7 +644,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r,
|
|||||||
|
|
||||||
if (backend_failed) {
|
if (backend_failed) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: dialog to %pI (%s) failed",
|
"dialog to %pI (%s) failed",
|
||||||
conn->worker->cp->addr,
|
conn->worker->cp->addr,
|
||||||
conn->worker->s->hostname);
|
conn->worker->s->hostname);
|
||||||
/*
|
/*
|
||||||
@@ -727,11 +727,11 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
if (strncasecmp(url, "ajp:", 4) != 0) {
|
if (strncasecmp(url, "ajp:", 4) != 0) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: AJP: declining URL %s", url);
|
"AJP: declining URL %s", url);
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
||||||
"proxy: AJP: serving URL %s", url);
|
"AJP: serving URL %s", url);
|
||||||
|
|
||||||
/* create space for state information */
|
/* create space for state information */
|
||||||
status = ap_proxy_acquire_connection(scheme, &backend, worker,
|
status = ap_proxy_acquire_connection(scheme, &backend, worker,
|
||||||
@@ -762,7 +762,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
/* Step Two: Make the Connection */
|
/* Step Two: Make the Connection */
|
||||||
if (ap_proxy_connect_backend(scheme, backend, worker, r->server)) {
|
if (ap_proxy_connect_backend(scheme, backend, worker, r->server)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
||||||
"proxy: AJP: failed to make connection to backend: %s",
|
"AJP: failed to make connection to backend: %s",
|
||||||
backend->hostname);
|
backend->hostname);
|
||||||
status = HTTP_SERVICE_UNAVAILABLE;
|
status = HTTP_SERVICE_UNAVAILABLE;
|
||||||
break;
|
break;
|
||||||
@@ -781,7 +781,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
backend->close++;
|
backend->close++;
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
||||||
"proxy: AJP: cping/cpong failed to %pI (%s)",
|
"AJP: cping/cpong failed to %pI (%s)",
|
||||||
worker->cp->addr,
|
worker->cp->addr,
|
||||||
worker->s->hostname);
|
worker->s->hostname);
|
||||||
status = HTTP_SERVICE_UNAVAILABLE;
|
status = HTTP_SERVICE_UNAVAILABLE;
|
||||||
|
@@ -67,8 +67,7 @@ static int proxy_balancer_canon(request_rec *r, char *url)
|
|||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url);
|
||||||
"proxy: BALANCER: canonicalising URL %s", url);
|
|
||||||
|
|
||||||
/* do syntatic check.
|
/* do syntatic check.
|
||||||
* We break the URL into host, port, path, search
|
* We break the URL into host, port, path, search
|
||||||
@@ -276,18 +275,18 @@ static proxy_worker *find_session_route(proxy_balancer *balancer,
|
|||||||
/* Try to find the sticky route inside url */
|
/* Try to find the sticky route inside url */
|
||||||
*route = get_path_param(r->pool, *url, balancer->s->sticky_path, balancer->s->scolonsep);
|
*route = get_path_param(r->pool, *url, balancer->s->sticky_path, balancer->s->scolonsep);
|
||||||
if (*route) {
|
if (*route) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: BALANCER: Found value %s for "
|
"Found value %s for stickysession %s",
|
||||||
"stickysession %s", *route, balancer->s->sticky_path);
|
*route, balancer->s->sticky_path);
|
||||||
*sticky_used = balancer->s->sticky_path;
|
*sticky_used = balancer->s->sticky_path;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*route = get_cookie_param(r, balancer->s->sticky);
|
*route = get_cookie_param(r, balancer->s->sticky);
|
||||||
if (*route) {
|
if (*route) {
|
||||||
*sticky_used = balancer->s->sticky;
|
*sticky_used = balancer->s->sticky;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: BALANCER: Found value %s for "
|
"Found value %s for stickysession %s",
|
||||||
"stickysession %s", *route, balancer->s->sticky);
|
*route, balancer->s->sticky);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -297,8 +296,7 @@ static proxy_worker *find_session_route(proxy_balancer *balancer,
|
|||||||
if ((*route) && ((*route = strchr(*route, '.')) != NULL ))
|
if ((*route) && ((*route = strchr(*route, '.')) != NULL ))
|
||||||
(*route)++;
|
(*route)++;
|
||||||
if ((*route) && (**route)) {
|
if ((*route) && (**route)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Found route %s", *route);
|
||||||
"proxy: BALANCER: Found route %s", *route);
|
|
||||||
/* We have a route in path or in cookie
|
/* We have a route in path or in cookie
|
||||||
* Find the worker that has this route defined.
|
* Find the worker that has this route defined.
|
||||||
*/
|
*/
|
||||||
@@ -309,9 +307,9 @@ static proxy_worker *find_session_route(proxy_balancer *balancer,
|
|||||||
* the route supplied by the client.
|
* the route supplied by the client.
|
||||||
*/
|
*/
|
||||||
apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
|
apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: BALANCER: Route changed from %s to %s",
|
"Route changed from %s to %s",
|
||||||
*route, worker->s->route);
|
*route, worker->s->route);
|
||||||
}
|
}
|
||||||
return worker;
|
return worker;
|
||||||
}
|
}
|
||||||
@@ -326,8 +324,9 @@ static proxy_worker *find_best_worker(proxy_balancer *balancer,
|
|||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
|
|
||||||
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Lock failed for find_best_worker()", balancer->name);
|
"%s: Lock failed for find_best_worker()",
|
||||||
|
balancer->name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,8 +336,9 @@ static proxy_worker *find_best_worker(proxy_balancer *balancer,
|
|||||||
candidate->s->elected++;
|
candidate->s->elected++;
|
||||||
|
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for find_best_worker()", balancer->name);
|
"%s: Unlock failed for find_best_worker()",
|
||||||
|
balancer->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidate == NULL) {
|
if (candidate == NULL) {
|
||||||
@@ -428,7 +428,7 @@ static void force_recovery(proxy_balancer *balancer, server_rec *s)
|
|||||||
++(*worker)->s->retries;
|
++(*worker)->s->retries;
|
||||||
(*worker)->s->status &= ~PROXY_WORKER_IN_ERROR;
|
(*worker)->s->status &= ~PROXY_WORKER_IN_ERROR;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: BALANCER: (%s). Forcing recovery for worker (%s)",
|
"%s: Forcing recovery for worker (%s)",
|
||||||
balancer->name, (*worker)->s->hostname);
|
balancer->name, (*worker)->s->hostname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -459,9 +459,8 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
|
|||||||
* XXX: perhaps we need the process lock here
|
* XXX: perhaps we need the process lock here
|
||||||
*/
|
*/
|
||||||
if ((rv = PROXY_THREAD_LOCK(*balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_LOCK(*balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Lock failed for pre_request",
|
"%s: Lock failed for pre_request", (*balancer)->name);
|
||||||
(*balancer)->name);
|
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -521,34 +520,34 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
|
|||||||
workers++;
|
workers++;
|
||||||
}
|
}
|
||||||
if (member_of) {
|
if (member_of) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: BALANCER: (%s). All workers are in error state for route (%s)",
|
"%s: All workers are in error state for route (%s)",
|
||||||
(*balancer)->name, route);
|
(*balancer)->name, route);
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for pre_request",
|
"%s: Unlock failed for pre_request",
|
||||||
(*balancer)->name);
|
(*balancer)->name);
|
||||||
}
|
}
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for pre_request",
|
"%s: Unlock failed for pre_request",
|
||||||
(*balancer)->name);
|
(*balancer)->name);
|
||||||
}
|
}
|
||||||
if (!*worker) {
|
if (!*worker) {
|
||||||
runtime = find_best_worker(*balancer, r);
|
runtime = find_best_worker(*balancer, r);
|
||||||
if (!runtime) {
|
if (!runtime) {
|
||||||
if ((*balancer)->workers->nelts) {
|
if ((*balancer)->workers->nelts) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: BALANCER: (%s). All workers are in error state",
|
"%s: All workers are in error state",
|
||||||
(*balancer)->name);
|
(*balancer)->name);
|
||||||
} else {
|
} else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: BALANCER: (%s). No workers in balancer",
|
"%s: No workers in balancer",
|
||||||
(*balancer)->name);
|
(*balancer)->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
@@ -594,9 +593,9 @@ static int proxy_balancer_pre_request(proxy_worker **worker,
|
|||||||
apr_table_setn(r->subprocess_env,
|
apr_table_setn(r->subprocess_env,
|
||||||
"BALANCER_SESSION_ROUTE", route);
|
"BALANCER_SESSION_ROUTE", route);
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: BALANCER (%s) worker (%s) rewritten to %s",
|
"%s: worker (%s) rewritten to %s",
|
||||||
(*balancer)->name, (*worker)->s->name, *url);
|
(*balancer)->name, (*worker)->s->name, *url);
|
||||||
|
|
||||||
return access_status;
|
return access_status;
|
||||||
}
|
}
|
||||||
@@ -610,9 +609,9 @@ static int proxy_balancer_post_request(proxy_worker *worker,
|
|||||||
apr_status_t rv;
|
apr_status_t rv;
|
||||||
|
|
||||||
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Lock failed for post_request",
|
"%s: Lock failed for post_request",
|
||||||
balancer->name);
|
balancer->name);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -621,9 +620,10 @@ static int proxy_balancer_post_request(proxy_worker *worker,
|
|||||||
for (i = 0; i < balancer->errstatuses->nelts; i++) {
|
for (i = 0; i < balancer->errstatuses->nelts; i++) {
|
||||||
int val = ((int *)balancer->errstatuses->elts)[i];
|
int val = ((int *)balancer->errstatuses->elts)[i];
|
||||||
if (r->status == val) {
|
if (r->status == val) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Forcing recovery for worker (%s), failonstatus %d",
|
"%s: Forcing recovery for worker (%s), "
|
||||||
balancer->name, worker->s->name, val);
|
"failonstatus %d",
|
||||||
|
balancer->name, worker->s->name, val);
|
||||||
worker->s->status |= PROXY_WORKER_IN_ERROR;
|
worker->s->status |= PROXY_WORKER_IN_ERROR;
|
||||||
worker->s->error_time = apr_time_now();
|
worker->s->error_time = apr_time_now();
|
||||||
break;
|
break;
|
||||||
@@ -632,12 +632,11 @@ static int proxy_balancer_post_request(proxy_worker *worker,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for post_request",
|
"%s: Unlock failed for post_request", balancer->name);
|
||||||
balancer->name);
|
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy_balancer_post_request for (%s)", balancer->name);
|
"proxy_balancer_post_request for (%s)", balancer->name);
|
||||||
|
|
||||||
if (worker && worker->s->busy)
|
if (worker && worker->s->busy)
|
||||||
worker->s->busy--;
|
worker->s->busy--;
|
||||||
@@ -706,7 +705,7 @@ static int balancer_post_config(apr_pool_t *pconf, apr_pool_t *plog,
|
|||||||
storage = ap_lookup_provider(AP_SLOTMEM_PROVIDER_GROUP, "shared",
|
storage = ap_lookup_provider(AP_SLOTMEM_PROVIDER_GROUP, "shared",
|
||||||
AP_SLOTMEM_PROVIDER_VERSION);
|
AP_SLOTMEM_PROVIDER_VERSION);
|
||||||
if (!storage) {
|
if (!storage) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s,
|
||||||
"ap_lookup_provider %s failed: is mod_slotmem_shm loaded??",
|
"ap_lookup_provider %s failed: is mod_slotmem_shm loaded??",
|
||||||
AP_SLOTMEM_PROVIDER_GROUP);
|
AP_SLOTMEM_PROVIDER_GROUP);
|
||||||
return !OK;
|
return !OK;
|
||||||
@@ -921,21 +920,21 @@ static int balancer_handler(request_rec *r)
|
|||||||
balancer = (proxy_balancer *)conf->balancers->elts;
|
balancer = (proxy_balancer *)conf->balancers->elts;
|
||||||
for (i = 0; i < conf->balancers->nelts; i++, balancer++) {
|
for (i = 0; i < conf->balancers->nelts; i++, balancer++) {
|
||||||
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Lock failed for balancer_handler",
|
"%s: Lock failed for balancer_handler",
|
||||||
balancer->name);
|
balancer->name);
|
||||||
}
|
}
|
||||||
ap_proxy_sync_balancer(balancer, r->server, conf);
|
ap_proxy_sync_balancer(balancer, r->server, conf);
|
||||||
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
|
if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for balancer_handler",
|
"%s: Unlock failed for balancer_handler",
|
||||||
balancer->name);
|
balancer->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r->args && (r->method_number == M_GET)) {
|
if (r->args && (r->method_number == M_GET)) {
|
||||||
const char *allowed[] = { "w", "b", "nonce", NULL };
|
const char *allowed[] = { "w", "b", "nonce", NULL };
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "parsing r->args");
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "parsing r->args");
|
||||||
|
|
||||||
push2table(r->args, params, allowed, r->pool);
|
push2table(r->args, params, allowed, r->pool);
|
||||||
}
|
}
|
||||||
@@ -982,7 +981,7 @@ static int balancer_handler(request_rec *r)
|
|||||||
const char *val;
|
const char *val;
|
||||||
int was_usable = PROXY_WORKER_IS_USABLE(wsel);
|
int was_usable = PROXY_WORKER_IS_USABLE(wsel);
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "settings worker params");
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "settings worker params");
|
||||||
|
|
||||||
if ((val = apr_table_get(params, "w_lf"))) {
|
if ((val = apr_table_get(params, "w_lf"))) {
|
||||||
int ival = atoi(val);
|
int ival = atoi(val);
|
||||||
@@ -1032,7 +1031,8 @@ static int balancer_handler(request_rec *r)
|
|||||||
if (bsel && ok2change) {
|
if (bsel && ok2change) {
|
||||||
const char *val;
|
const char *val;
|
||||||
int ival;
|
int ival;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "settings balancer params");
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
|
"settings balancer params");
|
||||||
if ((val = apr_table_get(params, "b_lbm"))) {
|
if ((val = apr_table_get(params, "b_lbm"))) {
|
||||||
if ((strlen(val) < (sizeof(bsel->s->lbpname)-1)) &&
|
if ((strlen(val) < (sizeof(bsel->s->lbpname)-1)) &&
|
||||||
strcmp(val, bsel->s->lbpname)) {
|
strcmp(val, bsel->s->lbpname)) {
|
||||||
@@ -1086,9 +1086,9 @@ static int balancer_handler(request_rec *r)
|
|||||||
nworker = ap_proxy_get_worker(conf->pool, bsel, conf, val);
|
nworker = ap_proxy_get_worker(conf->pool, bsel, conf, val);
|
||||||
if (!nworker && storage->num_free_slots(bsel->slot)) {
|
if (!nworker && storage->num_free_slots(bsel->slot)) {
|
||||||
if ((rv = PROXY_GLOBAL_LOCK(bsel)) != APR_SUCCESS) {
|
if ((rv = PROXY_GLOBAL_LOCK(bsel)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Lock failed for adding worker",
|
"%s: Lock failed for adding worker",
|
||||||
bsel->name);
|
bsel->name);
|
||||||
}
|
}
|
||||||
ret = ap_proxy_define_worker(conf->pool, &nworker, bsel, conf, val, 0);
|
ret = ap_proxy_define_worker(conf->pool, &nworker, bsel, conf, val, 0);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
@@ -1096,38 +1096,42 @@ static int balancer_handler(request_rec *r)
|
|||||||
proxy_worker_shared *shm;
|
proxy_worker_shared *shm;
|
||||||
PROXY_COPY_CONF_PARAMS(nworker, conf);
|
PROXY_COPY_CONF_PARAMS(nworker, conf);
|
||||||
if ((rv = storage->grab(bsel->slot, &index)) != APR_SUCCESS) {
|
if ((rv = storage->grab(bsel->slot, &index)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, r->server, "worker slotmem_grab failed");
|
ap_log_rerror(APLOG_MARK, APLOG_EMERG, rv, r,
|
||||||
|
"worker slotmem_grab failed");
|
||||||
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for adding worker",
|
"%s: Unlock failed for adding worker",
|
||||||
bsel->name);
|
bsel->name);
|
||||||
}
|
}
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
if ((rv = storage->dptr(bsel->slot, index, (void *)&shm)) != APR_SUCCESS) {
|
if ((rv = storage->dptr(bsel->slot, index, (void *)&shm)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, r->server, "worker slotmem_dptr failed");
|
ap_log_rerror(APLOG_MARK, APLOG_EMERG, rv, r,
|
||||||
|
"worker slotmem_dptr failed");
|
||||||
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for adding worker",
|
"%s: Unlock failed for adding worker",
|
||||||
bsel->name);
|
bsel->name);
|
||||||
}
|
}
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
if ((rv = ap_proxy_share_worker(nworker, shm, index)) != APR_SUCCESS) {
|
if ((rv = ap_proxy_share_worker(nworker, shm, index)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, r->server, "Cannot share worker");
|
ap_log_rerror(APLOG_MARK, APLOG_EMERG, rv, r,
|
||||||
|
"Cannot share worker");
|
||||||
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for adding worker",
|
"%s: Unlock failed for adding worker",
|
||||||
bsel->name);
|
bsel->name);
|
||||||
}
|
}
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
if ((rv = ap_proxy_initialize_worker(nworker, r->server, conf->pool)) != APR_SUCCESS) {
|
if ((rv = ap_proxy_initialize_worker(nworker, r->server, conf->pool)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_EMERG, rv, r->server, "Cannot init worker");
|
ap_log_rerror(APLOG_MARK, APLOG_EMERG, rv, r,
|
||||||
|
"Cannot init worker");
|
||||||
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for adding worker",
|
"%s: Unlock failed for adding worker",
|
||||||
bsel->name);
|
bsel->name);
|
||||||
}
|
}
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
@@ -1137,9 +1141,9 @@ static int balancer_handler(request_rec *r)
|
|||||||
ap_proxy_set_wstatus('D', 1, nworker);
|
ap_proxy_set_wstatus('D', 1, nworker);
|
||||||
}
|
}
|
||||||
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: BALANCER: (%s). Unlock failed for adding worker",
|
"%s: Unlock failed for adding worker",
|
||||||
bsel->name);
|
bsel->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1148,7 +1152,7 @@ static int balancer_handler(request_rec *r)
|
|||||||
}
|
}
|
||||||
|
|
||||||
action = ap_construct_url(r->pool, r->uri, r);
|
action = ap_construct_url(r->pool, r->uri, r);
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "genning page");
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "genning page");
|
||||||
|
|
||||||
if (apr_table_get(params, "xml")) {
|
if (apr_table_get(params, "xml")) {
|
||||||
ap_set_content_type(r, "text/xml");
|
ap_set_content_type(r, "text/xml");
|
||||||
@@ -1371,7 +1375,7 @@ static void balancer_child_init(apr_pool_t *p, server_rec *s)
|
|||||||
unsigned int num;
|
unsigned int num;
|
||||||
storage->attach(&(conf->slot), conf->id, &size, &num, p);
|
storage->attach(&(conf->slot), conf->id, &size, &num, p);
|
||||||
if (!conf->slot) {
|
if (!conf->slot) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s, "slotmem_attach failed");
|
ap_log_error(APLOG_MARK, APLOG_EMERG, 0, s, "slotmem_attach failed");
|
||||||
exit(1); /* Ugly, but what else? */
|
exit(1); /* Ugly, but what else? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -138,8 +138,7 @@ static int proxy_connect_canon(request_rec *r, char *url)
|
|||||||
if (r->method_number != M_CONNECT) {
|
if (r->method_number != M_CONNECT) {
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url);
|
||||||
"proxy: CONNECT: canonicalising URL %s", url);
|
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -166,7 +165,7 @@ static int proxy_connect_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
|
|||||||
len = -1;
|
len = -1;
|
||||||
apr_brigade_length(bb, 0, &len);
|
apr_brigade_length(bb, 0, &len);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: CONNECT: read %" APR_OFF_T_FMT
|
"read %" APR_OFF_T_FMT
|
||||||
" bytes from %s", len, name);
|
" bytes from %s", len, name);
|
||||||
#endif
|
#endif
|
||||||
rv = ap_pass_brigade(c_o->output_filters, bb);
|
rv = ap_pass_brigade(c_o->output_filters, bb);
|
||||||
@@ -175,12 +174,12 @@ static int proxy_connect_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: CONNECT: error on %s - ap_pass_brigade",
|
"error on %s - ap_pass_brigade",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
} else if (!APR_STATUS_IS_EAGAIN(rv)) {
|
} else if (!APR_STATUS_IS_EAGAIN(rv)) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
|
||||||
"proxy: CONNECT: error on %s - ap_get_brigade",
|
"error on %s - ap_get_brigade",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
} while (rv == APR_SUCCESS);
|
} while (rv == APR_SUCCESS);
|
||||||
@@ -225,12 +224,10 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
/* is this for us? */
|
/* is this for us? */
|
||||||
if (r->method_number != M_CONNECT) {
|
if (r->method_number != M_CONNECT) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "declining URL %s", url);
|
||||||
"proxy: CONNECT: declining URL %s", url);
|
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "serving URL %s", url);
|
||||||
"proxy: CONNECT: serving URL %s", url);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -246,9 +243,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
NULL));
|
NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname,
|
"connecting %s to %s:%d", url, uri.hostname, uri.port);
|
||||||
uri.port);
|
|
||||||
|
|
||||||
/* do a DNS lookup for the destination host */
|
/* do a DNS lookup for the destination host */
|
||||||
err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port,
|
err = apr_sockaddr_info_get(&uri_addr, uri.hostname, APR_UNSPEC, uri.port,
|
||||||
@@ -271,9 +267,9 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
connectport = uri.port;
|
connectport = uri.port;
|
||||||
connect_addr = uri_addr;
|
connect_addr = uri_addr;
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||||
"proxy: CONNECT: connecting to remote proxy %s on port %d",
|
"connecting to remote proxy %s on port %d",
|
||||||
connectname, connectport);
|
connectname, connectport);
|
||||||
|
|
||||||
/* check if ProxyBlock directive on this host */
|
/* check if ProxyBlock directive on this host */
|
||||||
if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) {
|
if (OK != ap_proxy_checkproxyblock(r, conf, uri_addr)) {
|
||||||
@@ -326,13 +322,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* setup polling for connection */
|
/* setup polling for connection */
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "setting up poll()");
|
||||||
"proxy: CONNECT: setting up poll()");
|
|
||||||
|
|
||||||
if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) {
|
if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) {
|
||||||
apr_socket_close(sock);
|
apr_socket_close(sock);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: CONNECT: error apr_pollset_create()");
|
"error apr_pollset_create()");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +354,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (!backconn) {
|
if (!backconn) {
|
||||||
/* peer reset */
|
/* peer reset */
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
||||||
"proxy: an error occurred creating a new connection "
|
"an error occurred creating a new connection "
|
||||||
"to %pI (%s)", connect_addr, connectname);
|
"to %pI (%s)", connect_addr, connectname);
|
||||||
apr_socket_close(sock);
|
apr_socket_close(sock);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
@@ -369,12 +364,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (rc != OK && rc != DONE) {
|
if (rc != OK && rc != DONE) {
|
||||||
backconn->aborted = 1;
|
backconn->aborted = 1;
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: CONNECT: pre_connection setup failed (%d)", rc);
|
"pre_connection setup failed (%d)", rc);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: CONNECT: connection complete to %pI (%s)",
|
"connection complete to %pI (%s)",
|
||||||
connect_addr, connectname);
|
connect_addr, connectname);
|
||||||
apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu",
|
apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu",
|
||||||
backconn->local_addr->port));
|
backconn->local_addr->port));
|
||||||
@@ -385,9 +380,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (proxyport) {
|
if (proxyport) {
|
||||||
/* FIXME: Error checking ignored.
|
/* FIXME: Error checking ignored.
|
||||||
*/
|
*/
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: CONNECT: sending the CONNECT request"
|
"sending the CONNECT request to the remote proxy");
|
||||||
" to the remote proxy");
|
|
||||||
ap_fprintf(backconn->output_filters, bb,
|
ap_fprintf(backconn->output_filters, bb,
|
||||||
"CONNECT %s HTTP/1.0" CRLF, r->uri);
|
"CONNECT %s HTTP/1.0" CRLF, r->uri);
|
||||||
ap_fprintf(backconn->output_filters, bb,
|
ap_fprintf(backconn->output_filters, bb,
|
||||||
@@ -395,8 +389,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
ap_fflush(backconn->output_filters, bb);
|
ap_fflush(backconn->output_filters, bb);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "Returning 200 OK");
|
||||||
"proxy: CONNECT: Returning 200 OK Status");
|
|
||||||
nbytes = apr_snprintf(buffer, sizeof(buffer),
|
nbytes = apr_snprintf(buffer, sizeof(buffer),
|
||||||
"HTTP/1.0 200 Connection Established" CRLF);
|
"HTTP/1.0 200 Connection Established" CRLF);
|
||||||
ap_xlate_proto_to_ascii(buffer, nbytes);
|
ap_xlate_proto_to_ascii(buffer, nbytes);
|
||||||
@@ -418,8 +411,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "setting up poll()");
|
||||||
"proxy: CONNECT: setting up poll()");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step Four: Handle Data Transfer
|
* Step Four: Handle Data Transfer
|
||||||
@@ -443,12 +435,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
apr_socket_close(sock);
|
apr_socket_close(sock);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "proxy: CONNECT: error apr_poll()");
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "error apr_poll()");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: CONNECT: woke from poll(), i=%d", pollcnt);
|
"woke from poll(), i=%d", pollcnt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (pi = 0; pi < pollcnt; pi++) {
|
for (pi = 0; pi < pollcnt; pi++) {
|
||||||
@@ -459,7 +451,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (pollevent & APR_POLLIN) {
|
if (pollevent & APR_POLLIN) {
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: CONNECT: sock was readable");
|
"sock was readable");
|
||||||
#endif
|
#endif
|
||||||
rv = proxy_connect_transfer(r, backconn, c, bb, "sock");
|
rv = proxy_connect_transfer(r, backconn, c, bb, "sock");
|
||||||
}
|
}
|
||||||
@@ -467,7 +459,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|| (pollevent & APR_POLLHUP)) {
|
|| (pollevent & APR_POLLHUP)) {
|
||||||
rv = APR_EPIPE;
|
rv = APR_EPIPE;
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r,
|
||||||
"proxy: CONNECT: err/hup on backconn");
|
"err/hup on backconn");
|
||||||
}
|
}
|
||||||
if (rv != APR_SUCCESS)
|
if (rv != APR_SUCCESS)
|
||||||
client_error = 1;
|
client_error = 1;
|
||||||
@@ -477,7 +469,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (pollevent & APR_POLLIN) {
|
if (pollevent & APR_POLLIN) {
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: CONNECT: client was readable");
|
"client was readable");
|
||||||
#endif
|
#endif
|
||||||
rv = proxy_connect_transfer(r, c, backconn, bb, "client");
|
rv = proxy_connect_transfer(r, c, backconn, bb, "client");
|
||||||
}
|
}
|
||||||
@@ -485,7 +477,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
else {
|
else {
|
||||||
rv = APR_EBADF;
|
rv = APR_EBADF;
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
||||||
"proxy: CONNECT: unknown socket in pollset");
|
"unknown socket in pollset");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -494,8 +486,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: CONNECT: finished with poll() - cleaning up");
|
"finished with poll() - cleaning up");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Step Five: Clean Up
|
* Step Five: Clean Up
|
||||||
|
@@ -86,8 +86,8 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
|
|||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||||
"proxy: FCGI: canonicalising URL %s", url);
|
"canonicalising URL %s", url);
|
||||||
|
|
||||||
err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
|
err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -117,13 +117,13 @@ static int proxy_fcgi_canon(request_rec *r, char *url)
|
|||||||
path, NULL);
|
path, NULL);
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FCGI: set r->filename to %s", r->filename);
|
"set r->filename to %s", r->filename);
|
||||||
|
|
||||||
if (apr_table_get(r->subprocess_env, "proxy-fcgi-pathinfo")) {
|
if (apr_table_get(r->subprocess_env, "proxy-fcgi-pathinfo")) {
|
||||||
r->path_info = apr_pstrcat(r->pool, "/", path, NULL);
|
r->path_info = apr_pstrcat(r->pool, "/", path, NULL);
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FCGI: set r->path_info to %s", r->path_info);
|
"set r->path_info to %s", r->path_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@@ -318,7 +318,7 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
|
|||||||
|
|
||||||
#ifdef FCGI_DUMP_ENV_VARS
|
#ifdef FCGI_DUMP_ENV_VARS
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FCGI: sending env var '%s' value '%s'",
|
"sending env var '%s' value '%s'",
|
||||||
elts[i].key, elts[i].val);
|
elts[i].key, elts[i].val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -334,7 +334,7 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r,
|
|||||||
/* The cast of bodylen is safe since FCGI_MAX_ENV_SIZE is for sure an int */
|
/* The cast of bodylen is safe since FCGI_MAX_ENV_SIZE is for sure an int */
|
||||||
if (envlen > FCGI_MAX_ENV_SIZE) {
|
if (envlen > FCGI_MAX_ENV_SIZE) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FCGI: truncating environment to %d bytes and %d elements",
|
"truncating environment to %d bytes and %d elements",
|
||||||
(int)bodylen, i);
|
(int)bodylen, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -499,8 +499,8 @@ static void dump_header_to_log(request_rec *r, unsigned char fheader[],
|
|||||||
if (i >= 20) {
|
if (i >= 20) {
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"HEADER: %s %s", asc_line, hex_line);
|
"HEADER: %s %s", asc_line, hex_line);
|
||||||
|
|
||||||
memset(asc_line, 0, sizeof(asc_line));
|
memset(asc_line, 0, sizeof(asc_line));
|
||||||
memset(hex_line, 0, sizeof(hex_line));
|
memset(hex_line, 0, sizeof(hex_line));
|
||||||
@@ -534,11 +534,11 @@ static void dump_header_to_log(request_rec *r, unsigned char fheader[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i != 1) {
|
if (i != 1) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "HEADER: %s %s",
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HEADER: %s %s",
|
||||||
asc_line, hex_line);
|
asc_line, hex_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "HEADER: -EOH-");
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HEADER: -EOH-");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,10 +671,10 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
|
|||||||
dump_header_to_log(r, farray, readbuflen);
|
dump_header_to_log(r, farray, readbuflen);
|
||||||
|
|
||||||
if (readbuflen != FCGI_HEADER_LEN) {
|
if (readbuflen != FCGI_HEADER_LEN) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: Failed to read entire header "
|
"Failed to read entire header "
|
||||||
"got %" APR_SIZE_T_FMT " wanted %d",
|
"got %" APR_SIZE_T_FMT " wanted %d",
|
||||||
readbuflen, FCGI_HEADER_LEN);
|
readbuflen, FCGI_HEADER_LEN);
|
||||||
rv = APR_EINVAL;
|
rv = APR_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -682,9 +682,8 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
|
|||||||
fcgi_header_from_array(&header, farray);
|
fcgi_header_from_array(&header, farray);
|
||||||
|
|
||||||
if (header.version != FCGI_VERSION) {
|
if (header.version != FCGI_VERSION) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: Got bogus version %d",
|
"Got bogus version %d", (int) header.version);
|
||||||
(int) header.version);
|
|
||||||
rv = APR_EINVAL;
|
rv = APR_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -695,9 +694,9 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
|
|||||||
rid |= header.requestIdB0;
|
rid |= header.requestIdB0;
|
||||||
|
|
||||||
if (rid != request_id) {
|
if (rid != request_id) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: Got bogus rid %d, expected %d",
|
"Got bogus rid %d, expected %d",
|
||||||
rid, request_id);
|
rid, request_id);
|
||||||
rv = APR_EINVAL;
|
rv = APR_EINVAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -750,8 +749,8 @@ recv_again:
|
|||||||
tmp_b = apr_bucket_eos_create(c->bucket_alloc);
|
tmp_b = apr_bucket_eos_create(c->bucket_alloc);
|
||||||
APR_BRIGADE_INSERT_TAIL(ob, tmp_b);
|
APR_BRIGADE_INSERT_TAIL(ob, tmp_b);
|
||||||
ap_pass_brigade(r->output_filters, ob);
|
ap_pass_brigade(r->output_filters, ob);
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: Error parsing script headers");
|
"Error parsing script headers");
|
||||||
r->status = status;
|
r->status = status;
|
||||||
rv = APR_EINVAL;
|
rv = APR_EINVAL;
|
||||||
break;
|
break;
|
||||||
@@ -829,8 +828,8 @@ recv_again:
|
|||||||
case FCGI_STDERR:
|
case FCGI_STDERR:
|
||||||
/* TODO: Should probably clean up this logging a bit... */
|
/* TODO: Should probably clean up this logging a bit... */
|
||||||
if (clen) {
|
if (clen) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: Got error '%s'", readbuf);
|
"Got error '%s'", readbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clen > readbuflen) {
|
if (clen > readbuflen) {
|
||||||
@@ -844,8 +843,8 @@ recv_again:
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: Got bogus record %d", type);
|
"Got bogus record %d", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -891,9 +890,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r,
|
|||||||
/* Step 1: Send FCGI_BEGIN_REQUEST */
|
/* Step 1: Send FCGI_BEGIN_REQUEST */
|
||||||
rv = send_begin_request(conn, request_id);
|
rv = send_begin_request(conn, request_id);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FCGI: Failed Writing Request to %s:",
|
"Failed Writing Request to %s:", server_portstr);
|
||||||
server_portstr);
|
|
||||||
conn->close = 1;
|
conn->close = 1;
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -901,9 +899,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r,
|
|||||||
/* Step 2: Send Environment via FCGI_PARAMS */
|
/* Step 2: Send Environment via FCGI_PARAMS */
|
||||||
rv = send_environment(conn, r, request_id);
|
rv = send_environment(conn, r, request_id);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FCGI: Failed writing Environment to %s:",
|
"Failed writing Environment to %s:", server_portstr);
|
||||||
server_portstr);
|
|
||||||
conn->close = 1;
|
conn->close = 1;
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -911,9 +908,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r,
|
|||||||
/* Step 3: Read records from the back end server and handle them. */
|
/* Step 3: Read records from the back end server and handle them. */
|
||||||
rv = dispatch(conn, conf, r, request_id);
|
rv = dispatch(conn, conf, r, request_id);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FCGI: Error dispatching request to %s:",
|
"Error dispatching request to %s:", server_portstr);
|
||||||
server_portstr);
|
|
||||||
conn->close = 1;
|
conn->close = 1;
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -943,21 +939,19 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
|
apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FCGI: url: %s proxyname: %s proxyport: %d",
|
"url: %s proxyname: %s proxyport: %d",
|
||||||
url, proxyname, proxyport);
|
url, proxyname, proxyport);
|
||||||
|
|
||||||
if (strncasecmp(url, "fcgi:", 5) == 0) {
|
if (strncasecmp(url, "fcgi:", 5) == 0) {
|
||||||
url += 5;
|
url += 5;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "declining URL %s", url);
|
||||||
"proxy: FCGI: declining URL %s", url);
|
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "serving URL %s", url);
|
||||||
"proxy: FCGI: serving URL %s", url);
|
|
||||||
|
|
||||||
/* Create space for state information */
|
/* Create space for state information */
|
||||||
if (! backend) {
|
if (! backend) {
|
||||||
@@ -991,9 +985,9 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
/* Step Two: Make the Connection */
|
/* Step Two: Make the Connection */
|
||||||
if (ap_proxy_connect_backend(FCGI_SCHEME, backend, worker, r->server)) {
|
if (ap_proxy_connect_backend(FCGI_SCHEME, backend, worker, r->server)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: FCGI: failed to make connection to backend: %s",
|
"failed to make connection to backend: %s",
|
||||||
backend->hostname);
|
backend->hostname);
|
||||||
status = HTTP_SERVICE_UNAVAILABLE;
|
status = HTTP_SERVICE_UNAVAILABLE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,7 @@ static int proxy_fdpass_canon(request_rec *r, char *url)
|
|||||||
r->filename = apr_pstrcat(r->pool, "proxy:fd://", path, NULL);
|
r->filename = apr_pstrcat(r->pool, "proxy:fd://", path, NULL);
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FD: set r->filename to %s", r->filename);
|
"set r->filename to %s", r->filename);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,8 +196,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FD: Failed to connect to '%s'",
|
"Failed to connect to '%s'", url);
|
||||||
url);
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,8 +209,8 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
if (!flush) {
|
if (!flush) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FD: Unable to find configured flush "
|
"Unable to find configured flush provider '%s'",
|
||||||
"provider '%s'", flush_method);
|
flush_method);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,8 +224,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
rv = send_socket(r->pool, sock, clientsock);
|
rv = send_socket(r->pool, sock, clientsock);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "send_socket failed:");
|
||||||
"proxy: FD: send_socket failed:");
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +238,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
|
|||||||
r->connection->pool);
|
r->connection->pool);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FD: failed to create dummy socket");
|
"failed to create dummy socket");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
ap_set_core_module_config(r->connection->conn_config, dummy);
|
ap_set_core_module_config(r->connection->conn_config, dummy);
|
||||||
@@ -267,7 +265,7 @@ static int standard_flush(request_rec *r)
|
|||||||
|
|
||||||
if (status != OK) {
|
if (status != OK) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: FD: ap_pass_brigade failed:");
|
"ap_pass_brigade failed:");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -228,8 +228,7 @@ static int proxy_ftp_canon(request_rec *r, char *url)
|
|||||||
}
|
}
|
||||||
def_port = apr_uri_port_of_scheme("ftp");
|
def_port = apr_uri_port_of_scheme("ftp");
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url);
|
||||||
"proxy: FTP: canonicalising URL %s", url);
|
|
||||||
|
|
||||||
port = def_port;
|
port = def_port;
|
||||||
err = ap_proxy_canon_netloc(p, &url, &user, &password, &host, &port);
|
err = ap_proxy_canon_netloc(p, &url, &user, &password, &host, &port);
|
||||||
@@ -319,7 +318,7 @@ static int ftp_getrc_msg(conn_rec *ftp_ctrl, apr_bucket_brigade *bb, char *msgbu
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, NULL,
|
||||||
"proxy: <FTP: %s", response);
|
"<%s", response);
|
||||||
*/
|
*/
|
||||||
if (!apr_isdigit(response[0]) || !apr_isdigit(response[1]) ||
|
if (!apr_isdigit(response[0]) || !apr_isdigit(response[1]) ||
|
||||||
!apr_isdigit(response[2]) || (response[3] != ' ' && response[3] != '-'))
|
!apr_isdigit(response[2]) || (response[3] != ' ' && response[3] != '-'))
|
||||||
@@ -615,8 +614,9 @@ static apr_status_t proxy_send_dir_filter(ap_filter_t *f,
|
|||||||
filename = strrchr(ctx->buffer, ' ');
|
filename = strrchr(ctx->buffer, ' ');
|
||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
/* Line is broken. Ignore it. */
|
/* Line is broken. Ignore it. */
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy_ftp: could not parse line %s", ctx->buffer);
|
"proxy_ftp: could not parse line %s",
|
||||||
|
ctx->buffer);
|
||||||
/* erase buffer for next time around */
|
/* erase buffer for next time around */
|
||||||
ctx->buffer[0] = 0;
|
ctx->buffer[0] = 0;
|
||||||
continue; /* while state is BODY */
|
continue; /* while state is BODY */
|
||||||
@@ -745,8 +745,7 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl,
|
|||||||
*crlf = '\0';
|
*crlf = '\0';
|
||||||
if (strncmp(message,"PASS ", 5) == 0)
|
if (strncmp(message,"PASS ", 5) == 0)
|
||||||
strcpy(&message[5], "****");
|
strcpy(&message[5], "****");
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, ">%s", message);
|
||||||
"proxy:>FTP: %s", message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof message);
|
rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof message);
|
||||||
@@ -755,8 +754,7 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl,
|
|||||||
if ((crlf = strchr(message, '\r')) != NULL ||
|
if ((crlf = strchr(message, '\r')) != NULL ||
|
||||||
(crlf = strchr(message, '\n')) != NULL)
|
(crlf = strchr(message, '\n')) != NULL)
|
||||||
*crlf = '\0';
|
*crlf = '\0';
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "<%3.3u %s", rc, message);
|
||||||
"proxy:<FTP: %3.3u %s", rc, message);
|
|
||||||
|
|
||||||
if (pmessage != NULL)
|
if (pmessage != NULL)
|
||||||
*pmessage = apr_pstrdup(r->pool, message);
|
*pmessage = apr_pstrdup(r->pool, message);
|
||||||
@@ -847,7 +845,7 @@ static int ftp_unauthorized(request_rec *r, int log_it)
|
|||||||
*/
|
*/
|
||||||
if (log_it)
|
if (log_it)
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
|
||||||
"proxy: missing or failed auth to %s",
|
"missing or failed auth to %s",
|
||||||
apr_uri_unparse(r->pool,
|
apr_uri_unparse(r->pool,
|
||||||
&r->parsed_uri, APR_URI_UNP_OMITPATHINFO));
|
&r->parsed_uri, APR_URI_UNP_OMITPATHINFO));
|
||||||
|
|
||||||
@@ -926,17 +924,17 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
/* is this for us? */
|
/* is this for us? */
|
||||||
if (proxyhost) {
|
if (proxyhost) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: FTP: declining URL %s - proxyhost %s specified:", url, proxyhost);
|
"declining URL %s - proxyhost %s specified:", url,
|
||||||
|
proxyhost);
|
||||||
return DECLINED; /* proxy connections are via HTTP */
|
return DECLINED; /* proxy connections are via HTTP */
|
||||||
}
|
}
|
||||||
if (strncasecmp(url, "ftp:", 4)) {
|
if (strncasecmp(url, "ftp:", 4)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: FTP: declining URL %s - not ftp:", url);
|
"declining URL %s - not ftp:", url);
|
||||||
return DECLINED; /* only interested in FTP */
|
return DECLINED; /* only interested in FTP */
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "serving URL %s", url);
|
||||||
"proxy: FTP: serving URL %s", url);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1032,14 +1030,13 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
password = "apache-proxy@";
|
password = "apache-proxy@";
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FTP: connecting %s to %s:%d", url, connectname, connectport);
|
"connecting %s to %s:%d", url, connectname, connectport);
|
||||||
|
|
||||||
if (worker->s->is_address_reusable) {
|
if (worker->s->is_address_reusable) {
|
||||||
if (!worker->cp->addr) {
|
if (!worker->cp->addr) {
|
||||||
if ((err = PROXY_THREAD_LOCK(worker->balancer)) != APR_SUCCESS) {
|
if ((err = PROXY_THREAD_LOCK(worker->balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "lock");
|
||||||
"proxy: FTP: lock");
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1058,8 +1055,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (worker->s->is_address_reusable && !worker->cp->addr) {
|
if (worker->s->is_address_reusable && !worker->cp->addr) {
|
||||||
worker->cp->addr = connect_addr;
|
worker->cp->addr = connect_addr;
|
||||||
if ((uerr = PROXY_THREAD_UNLOCK(worker->balancer)) != APR_SUCCESS) {
|
if ((uerr = PROXY_THREAD_UNLOCK(worker->balancer)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, uerr, r, "unlock");
|
||||||
"proxy: FTP: unlock");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -1103,9 +1099,9 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
|
|
||||||
if (ap_proxy_connect_backend("FTP", backend, worker, r->server)) {
|
if (ap_proxy_connect_backend("FTP", backend, worker, r->server)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FTP: an error occurred creating a new connection to %pI (%s)",
|
"an error occurred creating a new connection to %pI (%s)",
|
||||||
connect_addr, connectname);
|
connect_addr, connectname);
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -1122,8 +1118,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
origin = backend->connection;
|
origin = backend->connection;
|
||||||
sock = backend->sock;
|
sock = backend->sock;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||||
"proxy: FTP: control connection complete");
|
"control connection complete");
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1338,13 +1334,12 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (data_port) {
|
if (data_port) {
|
||||||
apr_sockaddr_t *epsv_addr;
|
apr_sockaddr_t *epsv_addr;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||||
"proxy: FTP: EPSV contacting remote host on port %d",
|
"EPSV contacting remote host on port %d", data_port);
|
||||||
data_port);
|
|
||||||
|
|
||||||
if ((rv = apr_socket_create(&data_sock, connect_addr->family, SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
if ((rv = apr_socket_create(&data_sock, connect_addr->family, SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: error creating EPSV socket");
|
"error creating EPSV socket");
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1353,13 +1348,15 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
&& (rv = apr_socket_opt_set(data_sock, APR_SO_RCVBUF,
|
&& (rv = apr_socket_opt_set(data_sock, APR_SO_RCVBUF,
|
||||||
conf->recv_buffer_size))) {
|
conf->recv_buffer_size))) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: apr_socket_opt_set(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
|
"apr_socket_opt_set(SO_RCVBUF): Failed to "
|
||||||
|
"set ProxyReceiveBufferSize, using default");
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = apr_socket_opt_set(data_sock, APR_TCP_NODELAY, 1);
|
rv = apr_socket_opt_set(data_sock, APR_TCP_NODELAY, 1);
|
||||||
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
|
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"apr_socket_opt_set(APR_TCP_NODELAY): Failed to set");
|
"apr_socket_opt_set(APR_TCP_NODELAY): "
|
||||||
|
"Failed to set");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make the connection */
|
/* make the connection */
|
||||||
@@ -1368,8 +1365,9 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
apr_sockaddr_info_get(&epsv_addr, data_ip, connect_addr->family, data_port, 0, p);
|
apr_sockaddr_info_get(&epsv_addr, data_ip, connect_addr->family, data_port, 0, p);
|
||||||
rv = apr_socket_connect(data_sock, epsv_addr);
|
rv = apr_socket_connect(data_sock, epsv_addr);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: EPSV attempt to connect to %pI failed - Firewall/NAT?", epsv_addr);
|
"EPSV attempt to connect to %pI failed - "
|
||||||
|
"Firewall/NAT?", epsv_addr);
|
||||||
return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, apr_psprintf(r->pool,
|
return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, apr_psprintf(r->pool,
|
||||||
"EPSV attempt to connect to %pI failed - firewall/NAT?", epsv_addr));
|
"EPSV attempt to connect to %pI failed - firewall/NAT?", epsv_addr));
|
||||||
}
|
}
|
||||||
@@ -1426,13 +1424,13 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
apr_sockaddr_t *pasv_addr;
|
apr_sockaddr_t *pasv_addr;
|
||||||
apr_port_t pasvport = (p1 << 8) + p0;
|
apr_port_t pasvport = (p1 << 8) + p0;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FTP: PASV contacting host %d.%d.%d.%d:%d",
|
"PASV contacting host %d.%d.%d.%d:%d",
|
||||||
h3, h2, h1, h0, pasvport);
|
h3, h2, h1, h0, pasvport);
|
||||||
|
|
||||||
if ((rv = apr_socket_create(&data_sock, connect_addr->family, SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
if ((rv = apr_socket_create(&data_sock, connect_addr->family, SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: error creating PASV socket");
|
"error creating PASV socket");
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1441,21 +1439,22 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
&& (rv = apr_socket_opt_set(data_sock, APR_SO_RCVBUF,
|
&& (rv = apr_socket_opt_set(data_sock, APR_SO_RCVBUF,
|
||||||
conf->recv_buffer_size))) {
|
conf->recv_buffer_size))) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: apr_socket_opt_set(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
|
"apr_socket_opt_set(SO_RCVBUF): Failed to set ProxyReceiveBufferSize, using default");
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = apr_socket_opt_set(data_sock, APR_TCP_NODELAY, 1);
|
rv = apr_socket_opt_set(data_sock, APR_TCP_NODELAY, 1);
|
||||||
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
|
if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"apr_socket_opt_set(APR_TCP_NODELAY): Failed to set");
|
"apr_socket_opt_set(APR_TCP_NODELAY): "
|
||||||
|
"Failed to set");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make the connection */
|
/* make the connection */
|
||||||
apr_sockaddr_info_get(&pasv_addr, apr_psprintf(p, "%d.%d.%d.%d", h3, h2, h1, h0), connect_addr->family, pasvport, 0, p);
|
apr_sockaddr_info_get(&pasv_addr, apr_psprintf(p, "%d.%d.%d.%d", h3, h2, h1, h0), connect_addr->family, pasvport, 0, p);
|
||||||
rv = apr_socket_connect(data_sock, pasv_addr);
|
rv = apr_socket_connect(data_sock, pasv_addr);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: PASV attempt to connect to %pI failed - Firewall/NAT?", pasv_addr);
|
"PASV attempt to connect to %pI failed - Firewall/NAT?", pasv_addr);
|
||||||
return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, apr_psprintf(r->pool,
|
return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, apr_psprintf(r->pool,
|
||||||
"PASV attempt to connect to %pI failed - firewall/NAT?", pasv_addr));
|
"PASV attempt to connect to %pI failed - firewall/NAT?", pasv_addr));
|
||||||
}
|
}
|
||||||
@@ -1476,7 +1475,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
if ((rv = apr_socket_create(&local_sock, connect_addr->family, SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
if ((rv = apr_socket_create(&local_sock, connect_addr->family, SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: error creating local socket");
|
"error creating local socket");
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1488,7 +1487,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
!= APR_SUCCESS) {
|
!= APR_SUCCESS) {
|
||||||
#ifndef _OSD_POSIX /* BS2000 has this option "always on" */
|
#ifndef _OSD_POSIX /* BS2000 has this option "always on" */
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: error setting reuseaddr option");
|
"error setting reuseaddr option");
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
#endif /* _OSD_POSIX */
|
#endif /* _OSD_POSIX */
|
||||||
@@ -1498,7 +1497,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
if ((rv = apr_socket_bind(local_sock, local_addr)) != APR_SUCCESS) {
|
if ((rv = apr_socket_bind(local_sock, local_addr)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: error binding to ftp data socket %pI", local_addr);
|
"error binding to ftp data socket %pI", local_addr);
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1506,7 +1505,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
/* only need a short queue */
|
/* only need a short queue */
|
||||||
if ((rv = apr_socket_listen(local_sock, 2)) != APR_SUCCESS) {
|
if ((rv = apr_socket_listen(local_sock, 2)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: error listening to ftp data socket %pI", local_addr);
|
"error listening to ftp data socket %pI", local_addr);
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1605,8 +1604,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
size = ftpmessage; /* already pstrdup'ed: no copy necessary */
|
size = ftpmessage; /* already pstrdup'ed: no copy necessary */
|
||||||
}
|
}
|
||||||
else if (rc == 550) { /* Not a regular file */
|
else if (rc == 550) { /* Not a regular file */
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r,
|
||||||
"proxy: FTP: SIZE shows this is a directory");
|
"SIZE shows this is a directory");
|
||||||
dirlisting = 1;
|
dirlisting = 1;
|
||||||
rc = proxy_ftp_command(apr_pstrcat(p, "CWD ",
|
rc = proxy_ftp_command(apr_pstrcat(p, "CWD ",
|
||||||
ftp_escape_globbingchars(p, path, fdconf), CRLF, NULL),
|
ftp_escape_globbingchars(p, path, fdconf), CRLF, NULL),
|
||||||
@@ -1738,8 +1737,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
"Error reading from remote server");
|
"Error reading from remote server");
|
||||||
}
|
}
|
||||||
if (rc == 550) {
|
if (rc == 550) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r,
|
||||||
"proxy: FTP: RETR failed, trying LIST instead");
|
"RETR failed, trying LIST instead");
|
||||||
|
|
||||||
/* Directory Listings should always be fetched in ASCII mode */
|
/* Directory Listings should always be fetched in ASCII mode */
|
||||||
dirlisting = 1;
|
dirlisting = 1;
|
||||||
@@ -1805,14 +1804,14 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
if (xfer_type != 'A' && size != NULL) {
|
if (xfer_type != 'A' && size != NULL) {
|
||||||
/* We "trust" the ftp server to really serve (size) bytes... */
|
/* We "trust" the ftp server to really serve (size) bytes... */
|
||||||
apr_table_setn(r->headers_out, "Content-Length", size);
|
apr_table_setn(r->headers_out, "Content-Length", size);
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: FTP: Content-Length set to %s", size);
|
"Content-Length set to %s", size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (r->content_type) {
|
if (r->content_type) {
|
||||||
apr_table_setn(r->headers_out, "Content-Type", r->content_type);
|
apr_table_setn(r->headers_out, "Content-Type", r->content_type);
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: FTP: Content-Type set to %s", r->content_type);
|
"Content-Type set to %s", r->content_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_MDTM) && (defined(HAVE_TIMEGM) || defined(HAVE_GMTOFF))
|
#if defined(USE_MDTM) && (defined(HAVE_TIMEGM) || defined(HAVE_GMTOFF))
|
||||||
@@ -1820,8 +1819,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
char datestr[APR_RFC822_DATE_LEN];
|
char datestr[APR_RFC822_DATE_LEN];
|
||||||
apr_rfc822_date(datestr, mtime);
|
apr_rfc822_date(datestr, mtime);
|
||||||
apr_table_set(r->headers_out, "Last-Modified", datestr);
|
apr_table_set(r->headers_out, "Last-Modified", datestr);
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: FTP: Last-Modified set to %s", datestr);
|
"Last-Modified set to %s", datestr);
|
||||||
}
|
}
|
||||||
#endif /* USE_MDTM */
|
#endif /* USE_MDTM */
|
||||||
|
|
||||||
@@ -1834,9 +1833,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
/* set content-encoding (not for dir listings, they are uncompressed)*/
|
/* set content-encoding (not for dir listings, they are uncompressed)*/
|
||||||
if (r->content_encoding != NULL && r->content_encoding[0] != '\0') {
|
if (r->content_encoding != NULL && r->content_encoding[0] != '\0') {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r,
|
||||||
"proxy: FTP: Content-Encoding set to %s",
|
"Content-Encoding set to %s", r->content_encoding);
|
||||||
r->content_encoding);
|
|
||||||
apr_table_setn(r->headers_out, "Content-Encoding", r->content_encoding);
|
apr_table_setn(r->headers_out, "Content-Encoding", r->content_encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1852,7 +1850,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: FTP: failed to accept data connection");
|
"failed to accept data connection");
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_BAD_GATEWAY;
|
return HTTP_BAD_GATEWAY;
|
||||||
}
|
}
|
||||||
@@ -1867,8 +1865,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
* the peer reset the connection already; ap_run_create_connection() closed
|
* the peer reset the connection already; ap_run_create_connection() closed
|
||||||
* the socket
|
* the socket
|
||||||
*/
|
*/
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FTP: an error occurred creating the transfer connection");
|
"an error occurred creating the transfer connection");
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
@@ -1881,9 +1879,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
/* set up the connection filters */
|
/* set up the connection filters */
|
||||||
rc = ap_run_pre_connection(data, data_sock);
|
rc = ap_run_pre_connection(data, data_sock);
|
||||||
if (rc != OK && rc != DONE) {
|
if (rc != OK && rc != DONE) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FTP: pre_connection setup failed (%d)",
|
"pre_connection setup failed (%d)", rc);
|
||||||
rc);
|
|
||||||
data->aborted = 1;
|
data->aborted = 1;
|
||||||
proxy_ftp_cleanup(r, backend);
|
proxy_ftp_cleanup(r, backend);
|
||||||
return rc;
|
return rc;
|
||||||
@@ -1908,8 +1905,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
apr_bucket *e;
|
apr_bucket *e;
|
||||||
int finish = FALSE;
|
int finish = FALSE;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "start body send");
|
||||||
"proxy: FTP: start body send");
|
|
||||||
|
|
||||||
/* read the body, pass it to the output filters */
|
/* read the body, pass it to the output filters */
|
||||||
while (ap_get_brigade(data->input_filters,
|
while (ap_get_brigade(data->input_filters,
|
||||||
@@ -1944,8 +1940,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
apr_socket_close(data_sock);
|
apr_socket_close(data_sock);
|
||||||
}
|
}
|
||||||
data_sock = NULL;
|
data_sock = NULL;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: FTP: data connection closed");
|
"data connection closed");
|
||||||
/* signal that we must leave */
|
/* signal that we must leave */
|
||||||
finish = TRUE;
|
finish = TRUE;
|
||||||
}
|
}
|
||||||
@@ -1971,15 +1967,13 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "end body send");
|
||||||
"proxy: FTP: end body send");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (data_sock) {
|
if (data_sock) {
|
||||||
ap_flush_conn(data);
|
ap_flush_conn(data);
|
||||||
apr_socket_close(data_sock);
|
apr_socket_close(data_sock);
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "data connection closed");
|
||||||
"proxy: FTP: data connection closed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve the final response for the RETR or LIST commands */
|
/* Retrieve the final response for the RETR or LIST commands */
|
||||||
|
@@ -53,8 +53,8 @@ static int proxy_http_canon(request_rec *r, char *url)
|
|||||||
}
|
}
|
||||||
def_port = apr_uri_port_of_scheme(scheme);
|
def_port = apr_uri_port_of_scheme(scheme);
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
|
||||||
"proxy: HTTP: canonicalising URL %s", url);
|
"HTTP: canonicalising URL %s", url);
|
||||||
|
|
||||||
/* do syntatic check.
|
/* do syntatic check.
|
||||||
* We break the URL into host, port, path, search
|
* We break the URL into host, port, path, search
|
||||||
@@ -63,8 +63,7 @@ static int proxy_http_canon(request_rec *r, char *url)
|
|||||||
err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
|
err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
|
||||||
if (err) {
|
if (err) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"error parsing URL %s: %s",
|
"error parsing URL %s: %s", url, err);
|
||||||
url, err);
|
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,9 +267,9 @@ static int pass_brigade(apr_bucket_alloc_t *bucket_alloc,
|
|||||||
p_conn->worker->s->transferred += transferred;
|
p_conn->worker->s->transferred += transferred;
|
||||||
status = ap_pass_brigade(origin->output_filters, bb);
|
status = ap_pass_brigade(origin->output_filters, bb);
|
||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: pass request body failed to %pI (%s)",
|
"pass request body failed to %pI (%s)",
|
||||||
p_conn->addr, p_conn->hostname);
|
p_conn->addr, p_conn->hostname);
|
||||||
if (origin->aborted) {
|
if (origin->aborted) {
|
||||||
const char *ssl_note;
|
const char *ssl_note;
|
||||||
|
|
||||||
@@ -442,7 +441,7 @@ static int stream_reqbody_cl(apr_pool_t *p,
|
|||||||
|
|
||||||
if (status || *endstr || endstr == old_cl_val || cl_val < 0) {
|
if (status || *endstr || endstr == old_cl_val || cl_val < 0) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: could not parse request Content-Length (%s)",
|
"could not parse request Content-Length (%s)",
|
||||||
old_cl_val);
|
old_cl_val);
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
@@ -479,7 +478,7 @@ static int stream_reqbody_cl(apr_pool_t *p,
|
|||||||
*/
|
*/
|
||||||
if (bytes_streamed > cl_val) {
|
if (bytes_streamed > cl_val) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: read more bytes of request body than expected "
|
"read more bytes of request body than expected "
|
||||||
"(got %" APR_OFF_T_FMT ", expected %" APR_OFF_T_FMT ")",
|
"(got %" APR_OFF_T_FMT ", expected %" APR_OFF_T_FMT ")",
|
||||||
bytes_streamed, cl_val);
|
bytes_streamed, cl_val);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
@@ -531,9 +530,9 @@ static int stream_reqbody_cl(apr_pool_t *p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bytes_streamed != cl_val) {
|
if (bytes_streamed != cl_val) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: client %s given Content-Length did not match"
|
"client %s given Content-Length did not match"
|
||||||
" number of body bytes read", r->connection->remote_ip);
|
" number of body bytes read", r->connection->remote_ip);
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,10 +588,9 @@ static int spool_reqbody_cl(apr_pool_t *p,
|
|||||||
* temporary file on disk.
|
* temporary file on disk.
|
||||||
*/
|
*/
|
||||||
if (bytes_spooled + bytes > limit) {
|
if (bytes_spooled + bytes > limit) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: Request body is larger than the"
|
"Request body is larger than the configured "
|
||||||
" configured limit of %" APR_OFF_T_FMT ".",
|
"limit of %" APR_OFF_T_FMT, limit);
|
||||||
limit);
|
|
||||||
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
return HTTP_REQUEST_ENTITY_TOO_LARGE;
|
||||||
}
|
}
|
||||||
/* can't spool any more in memory; write latest brigade to disk */
|
/* can't spool any more in memory; write latest brigade to disk */
|
||||||
@@ -602,8 +600,8 @@ static int spool_reqbody_cl(apr_pool_t *p,
|
|||||||
|
|
||||||
status = apr_temp_dir_get(&temp_dir, p);
|
status = apr_temp_dir_get(&temp_dir, p);
|
||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: search for temporary directory failed");
|
"search for temporary directory failed");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
apr_filepath_merge(&template, temp_dir,
|
apr_filepath_merge(&template, temp_dir,
|
||||||
@@ -611,9 +609,9 @@ static int spool_reqbody_cl(apr_pool_t *p,
|
|||||||
APR_FILEPATH_NATIVE, p);
|
APR_FILEPATH_NATIVE, p);
|
||||||
status = apr_file_mktemp(&tmpfile, template, 0, p);
|
status = apr_file_mktemp(&tmpfile, template, 0, p);
|
||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: creation of temporary file in directory %s failed",
|
"creation of temporary file in directory "
|
||||||
temp_dir);
|
"%s failed", temp_dir);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -631,9 +629,9 @@ static int spool_reqbody_cl(apr_pool_t *p,
|
|||||||
if (apr_file_name_get(&tmpfile_name, tmpfile) != APR_SUCCESS) {
|
if (apr_file_name_get(&tmpfile_name, tmpfile) != APR_SUCCESS) {
|
||||||
tmpfile_name = "(unknown)";
|
tmpfile_name = "(unknown)";
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: write to temporary file %s failed",
|
"write to temporary file %s failed",
|
||||||
tmpfile_name);
|
tmpfile_name);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
AP_DEBUG_ASSERT(bytes_read == bytes_written);
|
AP_DEBUG_ASSERT(bytes_read == bytes_written);
|
||||||
@@ -784,11 +782,10 @@ int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
|
|||||||
if (!hostname) {
|
if (!hostname) {
|
||||||
hostname = r->server->server_hostname;
|
hostname = r->server->server_hostname;
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: no HTTP 0.9 request (with no host line) "
|
"no HTTP 0.9 request (with no host line) "
|
||||||
"on incoming request and preserve host set "
|
"on incoming request and preserve host set "
|
||||||
"forcing hostname to be %s for uri %s",
|
"forcing hostname to be %s for uri %s",
|
||||||
hostname,
|
hostname, r->uri);
|
||||||
r->uri );
|
|
||||||
}
|
}
|
||||||
buf = apr_pstrcat(p, "Host: ", hostname, CRLF, NULL);
|
buf = apr_pstrcat(p, "Host: ", hostname, CRLF, NULL);
|
||||||
}
|
}
|
||||||
@@ -996,17 +993,16 @@ int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
|
|||||||
* do not modify add_te_chunked's logic
|
* do not modify add_te_chunked's logic
|
||||||
*/
|
*/
|
||||||
if (old_te_val && strcasecmp(old_te_val, "chunked") != 0) {
|
if (old_te_val && strcasecmp(old_te_val, "chunked") != 0) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: %s Transfer-Encoding is not supported",
|
"%s Transfer-Encoding is not supported", old_te_val);
|
||||||
old_te_val);
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_cl_val && old_te_val) {
|
if (old_cl_val && old_te_val) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_ENOTIMPL, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: client %s (%s) requested Transfer-Encoding "
|
"client %s (%s) requested Transfer-Encoding "
|
||||||
"chunked body with Content-Length (C-L ignored)",
|
"chunked body with Content-Length (C-L ignored)",
|
||||||
c->remote_ip, c->remote_host ? c->remote_host: "");
|
c->remote_ip, c->remote_host ? c->remote_host: "");
|
||||||
apr_table_unset(r->headers_in, "Content-Length");
|
apr_table_unset(r->headers_in, "Content-Length");
|
||||||
old_cl_val = NULL;
|
old_cl_val = NULL;
|
||||||
origin->keepalive = AP_CONN_CLOSE;
|
origin->keepalive = AP_CONN_CLOSE;
|
||||||
@@ -1027,11 +1023,11 @@ int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
|
|||||||
AP_MODE_READBYTES, APR_BLOCK_READ,
|
AP_MODE_READBYTES, APR_BLOCK_READ,
|
||||||
MAX_MEM_SPOOL - bytes_read);
|
MAX_MEM_SPOOL - bytes_read);
|
||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: prefetch request body failed to %pI (%s)"
|
"prefetch request body failed to %pI (%s)"
|
||||||
" from %s (%s)",
|
" from %s (%s)",
|
||||||
p_conn->addr, p_conn->hostname ? p_conn->hostname: "",
|
p_conn->addr, p_conn->hostname ? p_conn->hostname: "",
|
||||||
c->remote_ip, c->remote_host ? c->remote_host: "");
|
c->remote_ip, c->remote_host ? c->remote_host: "");
|
||||||
return HTTP_BAD_REQUEST;
|
return HTTP_BAD_REQUEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1049,11 +1045,11 @@ int ap_proxy_http_request(apr_pool_t *p, request_rec *r,
|
|||||||
*/
|
*/
|
||||||
status = ap_save_brigade(NULL, &input_brigade, &temp_brigade, p);
|
status = ap_save_brigade(NULL, &input_brigade, &temp_brigade, p);
|
||||||
if (status != APR_SUCCESS) {
|
if (status != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r,
|
||||||
"proxy: processing prefetched request body failed"
|
"processing prefetched request body failed"
|
||||||
" to %pI (%s) from %s (%s)",
|
" to %pI (%s) from %s (%s)",
|
||||||
p_conn->addr, p_conn->hostname ? p_conn->hostname: "",
|
p_conn->addr, p_conn->hostname ? p_conn->hostname: "",
|
||||||
c->remote_ip, c->remote_host ? c->remote_host: "");
|
c->remote_ip, c->remote_host ? c->remote_host: "");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1189,13 +1185,10 @@ skip_body:
|
|||||||
|
|
||||||
if (rv != OK) {
|
if (rv != OK) {
|
||||||
/* apr_status_t value has been logged in lower level method */
|
/* apr_status_t value has been logged in lower level method */
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: pass request body failed to %pI (%s)"
|
"pass request body failed to %pI (%s) from %s (%s)",
|
||||||
" from %s (%s)",
|
p_conn->addr, p_conn->hostname ? p_conn->hostname: "",
|
||||||
p_conn->addr,
|
c->remote_ip, c->remote_host ? c->remote_host: "");
|
||||||
p_conn->hostname ? p_conn->hostname: "",
|
|
||||||
c->remote_ip,
|
|
||||||
c->remote_host ? c->remote_host: "");
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1298,23 +1291,24 @@ static void ap_proxy_read_headers(request_rec *r, request_rec *rr,
|
|||||||
* the first line of the response.
|
* the first line of the response.
|
||||||
*/
|
*/
|
||||||
if (saw_headers) {
|
if (saw_headers) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: Starting body due to bogus non-header in headers "
|
"Starting body due to bogus non-header "
|
||||||
"returned by %s (%s)", r->uri, r->method);
|
"in headers returned by %s (%s)",
|
||||||
|
r->uri, r->method);
|
||||||
*pread_len = len;
|
*pread_len = len;
|
||||||
return ;
|
return ;
|
||||||
} else {
|
} else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: No HTTP headers "
|
"No HTTP headers returned by %s (%s)",
|
||||||
"returned by %s (%s)", r->uri, r->method);
|
r->uri, r->method);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* this is the psc->badopt == bad_ignore case */
|
/* this is the psc->badopt == bad_ignore case */
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: Ignoring bogus HTTP header "
|
"Ignoring bogus HTTP header returned by %s (%s)",
|
||||||
"returned by %s (%s)", r->uri, r->method);
|
r->uri, r->method);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1440,8 +1434,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
apr_status_t rc;
|
apr_status_t rc;
|
||||||
rc = apr_socket_timeout_set(backend->sock, worker->s->ping_timeout);
|
rc = apr_socket_timeout_set(backend->sock, worker->s->ping_timeout);
|
||||||
if (rc != APR_SUCCESS) {
|
if (rc != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rc, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
|
||||||
"proxy: could not set 100-Continue timeout");
|
"could not set 100-Continue timeout");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1470,11 +1464,10 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
}
|
}
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r,
|
||||||
"proxy: error reading status line from remote "
|
"error reading status line from remote "
|
||||||
"server %s:%d", backend->hostname, backend->port);
|
"server %s:%d", backend->hostname, backend->port);
|
||||||
if (APR_STATUS_IS_TIMEUP(rc)) {
|
if (APR_STATUS_IS_TIMEUP(rc)) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "read timeout");
|
||||||
"proxy: read timeout");
|
|
||||||
if (do_100_continue) {
|
if (do_100_continue) {
|
||||||
return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, "Timeout on 100-Continue");
|
return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, "Timeout on 100-Continue");
|
||||||
}
|
}
|
||||||
@@ -1495,7 +1488,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
apr_bucket *eos;
|
apr_bucket *eos;
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: Closing connection to client because"
|
"Closing connection to client because"
|
||||||
" reading from backend server %s:%d failed."
|
" reading from backend server %s:%d failed."
|
||||||
" Number of keepalives %i", backend->hostname,
|
" Number of keepalives %i", backend->hostname,
|
||||||
backend->port, c->keepalives);
|
backend->port, c->keepalives);
|
||||||
@@ -1530,10 +1523,10 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
}
|
}
|
||||||
else if (!c->keepalives) {
|
else if (!c->keepalives) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: NOT Closing connection to client"
|
"NOT Closing connection to client"
|
||||||
" although reading from backend server %s:%d"
|
" although reading from backend server %s:%d"
|
||||||
" failed.", backend->hostname,
|
" failed.",
|
||||||
backend->port);
|
backend->hostname, backend->port);
|
||||||
}
|
}
|
||||||
return ap_proxyerror(r, HTTP_BAD_GATEWAY,
|
return ap_proxyerror(r, HTTP_BAD_GATEWAY,
|
||||||
"Error reading from remote server");
|
"Error reading from remote server");
|
||||||
@@ -1600,10 +1593,9 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
&pread_len);
|
&pread_len);
|
||||||
|
|
||||||
if (r->headers_out == NULL) {
|
if (r->headers_out == NULL) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
r->server, "proxy: bad HTTP/%d.%d header "
|
"bad HTTP/%d.%d header returned by %s (%s)",
|
||||||
"returned by %s (%s)", major, minor, r->uri,
|
major, minor, r->uri, r->method);
|
||||||
r->method);
|
|
||||||
backend->close += 1;
|
backend->close += 1;
|
||||||
/*
|
/*
|
||||||
* ap_send_error relies on a headers_out to be present. we
|
* ap_send_error relies on a headers_out to be present. we
|
||||||
@@ -1641,10 +1633,10 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
* XXX: We aught to treat such a response as uncachable
|
* XXX: We aught to treat such a response as uncachable
|
||||||
*/
|
*/
|
||||||
apr_table_unset(r->headers_out, "Content-Length");
|
apr_table_unset(r->headers_out, "Content-Length");
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: server %s:%d returned Transfer-Encoding"
|
"server %s:%d returned Transfer-Encoding"
|
||||||
" and Content-Length", backend->hostname,
|
" and Content-Length",
|
||||||
backend->port);
|
backend->hostname, backend->port);
|
||||||
backend->close += 1;
|
backend->close += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1740,8 +1732,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
const char *policy = apr_table_get(r->subprocess_env,
|
const char *policy = apr_table_get(r->subprocess_env,
|
||||||
"proxy-interim-response");
|
"proxy-interim-response");
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: HTTP: received interim %d response",
|
"HTTP: received interim %d response", r->status);
|
||||||
r->status);
|
|
||||||
if (!policy || !strcasecmp(policy, "RFC")) {
|
if (!policy || !strcasecmp(policy, "RFC")) {
|
||||||
ap_send_interim_response(r, 1);
|
ap_send_interim_response(r, 1);
|
||||||
}
|
}
|
||||||
@@ -1750,7 +1741,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
*/
|
*/
|
||||||
else if (strcasecmp(policy, "Suppress")) {
|
else if (strcasecmp(policy, "Suppress")) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"undefined proxy interim response policy");
|
"undefined proxy interim response policy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Moved the fixups of Date headers and those affected by
|
/* Moved the fixups of Date headers and those affected by
|
||||||
@@ -1763,8 +1754,9 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
if ((buf = apr_table_get(r->headers_out, wa))) {
|
if ((buf = apr_table_get(r->headers_out, wa))) {
|
||||||
apr_table_set(r->err_headers_out, wa, buf);
|
apr_table_set(r->err_headers_out, wa, buf);
|
||||||
} else {
|
} else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: origin server sent 401 without WWW-Authenticate header");
|
"origin server sent 401 without "
|
||||||
|
"WWW-Authenticate header");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1832,8 +1824,7 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
|
|
||||||
apr_table_unset(r->headers_out,"Transfer-Encoding");
|
apr_table_unset(r->headers_out,"Transfer-Encoding");
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "start body send");
|
||||||
"proxy: start body send");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if we are overriding the errors, we can't put the content
|
* if we are overriding the errors, we can't put the content
|
||||||
@@ -1887,8 +1878,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
* our backend bailed on us. Pass along a 502 error
|
* our backend bailed on us. Pass along a 502 error
|
||||||
* error bucket
|
* error bucket
|
||||||
*/
|
*/
|
||||||
ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: error reading response");
|
"error reading response");
|
||||||
ap_proxy_backend_broke(r, bb);
|
ap_proxy_backend_broke(r, bb);
|
||||||
ap_pass_brigade(r->output_filters, bb);
|
ap_pass_brigade(r->output_filters, bb);
|
||||||
backend_broke = 1;
|
backend_broke = 1;
|
||||||
@@ -1902,9 +1893,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
backend->worker->s->read += readbytes;
|
backend->worker->s->read += readbytes;
|
||||||
#if DEBUGGING
|
#if DEBUGGING
|
||||||
{
|
{
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
r->server, "proxy (PID %d): readbytes: %#x",
|
"readbytes: %#x", readbytes);
|
||||||
getpid(), readbytes);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
@@ -1972,12 +1962,10 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
|
|||||||
|
|
||||||
} while (!finish);
|
} while (!finish);
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "end body send");
|
||||||
"proxy: end body send");
|
|
||||||
}
|
}
|
||||||
else if (!interim_response) {
|
else if (!interim_response) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "header only");
|
||||||
"proxy: header only");
|
|
||||||
|
|
||||||
/* make sure we release the backend connection as soon
|
/* make sure we release the backend connection as soon
|
||||||
* as we know we are done, so that the backend isn't
|
* as we know we are done, so that the backend isn't
|
||||||
@@ -2063,17 +2051,17 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
/* is it for us? */
|
/* is it for us? */
|
||||||
if (strcmp(scheme, "https") == 0) {
|
if (strcmp(scheme, "https") == 0) {
|
||||||
if (!ap_proxy_ssl_enable(NULL)) {
|
if (!ap_proxy_ssl_enable(NULL)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: HTTPS: declining URL %s"
|
"HTTPS: declining URL %s (mod_ssl not configured?)",
|
||||||
" (mod_ssl not configured?)", url);
|
url);
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
is_ssl = 1;
|
is_ssl = 1;
|
||||||
proxy_function = "HTTPS";
|
proxy_function = "HTTPS";
|
||||||
}
|
}
|
||||||
else if (!(strcmp(scheme, "http") == 0 || (strcmp(scheme, "ftp") == 0 && proxyname))) {
|
else if (!(strcmp(scheme, "http") == 0 || (strcmp(scheme, "ftp") == 0 && proxyname))) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HTTP: declining URL %s",
|
||||||
"proxy: HTTP: declining URL %s", url);
|
url);
|
||||||
return DECLINED; /* only interested in HTTP, or FTP via proxy */
|
return DECLINED; /* only interested in HTTP, or FTP via proxy */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2082,8 +2070,7 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
else
|
else
|
||||||
proxy_function = "FTP";
|
proxy_function = "FTP";
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "HTTP: serving URL %s", url);
|
||||||
"proxy: HTTP: serving URL %s", url);
|
|
||||||
|
|
||||||
|
|
||||||
/* create space for state information */
|
/* create space for state information */
|
||||||
@@ -2123,9 +2110,9 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
/* Step Two: Make the Connection */
|
/* Step Two: Make the Connection */
|
||||||
if (ap_proxy_connect_backend(proxy_function, backend, worker, r->server)) {
|
if (ap_proxy_connect_backend(proxy_function, backend, worker, r->server)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: HTTP: failed to make connection to backend: %s",
|
"HTTP: failed to make connection to backend: %s",
|
||||||
backend->hostname);
|
backend->hostname);
|
||||||
status = HTTP_SERVICE_UNAVAILABLE;
|
status = HTTP_SERVICE_UNAVAILABLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2154,9 +2141,9 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
conf, uri, locurl, server_portstr)) != OK) {
|
conf, uri, locurl, server_portstr)) != OK) {
|
||||||
if ((status == HTTP_SERVICE_UNAVAILABLE) && worker->s->ping_timeout_set) {
|
if ((status == HTTP_SERVICE_UNAVAILABLE) && worker->s->ping_timeout_set) {
|
||||||
backend->close = 1;
|
backend->close = 1;
|
||||||
ap_log_error(APLOG_MARK, APLOG_INFO, status, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_INFO, status, r,
|
||||||
"proxy: HTTP: 100-Continue failed to %pI (%s)",
|
"HTTP: 100-Continue failed to %pI (%s)",
|
||||||
worker->cp->addr, worker->s->hostname);
|
worker->cp->addr, worker->s->hostname);
|
||||||
retry++;
|
retry++;
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#define SCHEME "scgi"
|
#define SCHEME "scgi"
|
||||||
#define PROXY_FUNCTION "SCGI"
|
|
||||||
#define SCGI_MAGIC "SCGI"
|
#define SCGI_MAGIC "SCGI"
|
||||||
#define SCGI_PROTOCOL_VERSION "1"
|
#define SCGI_PROTOCOL_VERSION "1"
|
||||||
#define SCGI_DEFAULT_PORT (4000)
|
#define SCGI_DEFAULT_PORT (4000)
|
||||||
@@ -226,8 +225,8 @@ static int sendall(proxy_conn_rec *conn, const char *buf, apr_size_t length,
|
|||||||
written = length;
|
written = length;
|
||||||
if ((rv = apr_socket_send(conn->sock, buf, &written)) != APR_SUCCESS) {
|
if ((rv = apr_socket_send(conn->sock, buf, &written)) != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: " PROXY_FUNCTION ": sending data to "
|
"sending data to %s:%u failed",
|
||||||
"%s:%u failed", conn->hostname, conn->port);
|
conn->hostname, conn->port);
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,8 +336,7 @@ static int send_request_body(request_rec *r, proxy_conn_rec *conn)
|
|||||||
}
|
}
|
||||||
if (readlen == -1) {
|
if (readlen == -1) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": receiving request body "
|
"receiving request body failed");
|
||||||
"failed");
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,8 +371,8 @@ static int pass_response(request_rec *r, proxy_conn_rec *conn)
|
|||||||
APLOG_MODULE_INDEX);
|
APLOG_MODULE_INDEX);
|
||||||
if (status != OK) {
|
if (status != OK) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": error reading response "
|
"error reading response headers from %s:%u",
|
||||||
"headers from %s:%u", conn->hostname, conn->port);
|
conn->hostname, conn->port);
|
||||||
r->status_line = NULL;
|
r->status_line = NULL;
|
||||||
apr_brigade_destroy(bb);
|
apr_brigade_destroy(bb);
|
||||||
return status;
|
return status;
|
||||||
@@ -393,8 +391,7 @@ static int pass_response(request_rec *r, proxy_conn_rec *conn)
|
|||||||
scgi_request_config *req_conf = apr_palloc(r->pool,
|
scgi_request_config *req_conf = apr_palloc(r->pool,
|
||||||
sizeof(*req_conf));
|
sizeof(*req_conf));
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": Found %s: %s - "
|
"Found %s: %s - preparing subrequest.",
|
||||||
"preparing subrequest.",
|
|
||||||
conf->sendfile, location);
|
conf->sendfile, location);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -445,8 +442,7 @@ static int scgi_request_status(int *status, request_rec *r)
|
|||||||
switch (req_conf->type) {
|
switch (req_conf->type) {
|
||||||
case scgi_internal_redirect:
|
case scgi_internal_redirect:
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": Internal redirect to %s",
|
"Internal redirect to %s", req_conf->location);
|
||||||
req_conf->location);
|
|
||||||
|
|
||||||
r->status_line = NULL;
|
r->status_line = NULL;
|
||||||
if (r->method_number != M_GET) {
|
if (r->method_number != M_GET) {
|
||||||
@@ -461,8 +457,7 @@ static int scgi_request_status(int *status, request_rec *r)
|
|||||||
|
|
||||||
case scgi_sendfile:
|
case scgi_sendfile:
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": File subrequest to %s",
|
"File subrequest to %s", req_conf->location);
|
||||||
req_conf->location);
|
|
||||||
do {
|
do {
|
||||||
request_rec *rr;
|
request_rec *rr;
|
||||||
|
|
||||||
@@ -511,12 +506,12 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
|
|||||||
|
|
||||||
if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
|
if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": declining URL %s", url);
|
"declining URL %s", url);
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create space for state information */
|
/* Create space for state information */
|
||||||
status = ap_proxy_acquire_connection(PROXY_FUNCTION, &backend, worker,
|
status = ap_proxy_acquire_connection(__FUNCTION__, &backend, worker,
|
||||||
r->server);
|
r->server);
|
||||||
if (status != OK) {
|
if (status != OK) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -532,10 +527,10 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Step Two: Make the Connection */
|
/* Step Two: Make the Connection */
|
||||||
if (ap_proxy_connect_backend(PROXY_FUNCTION, backend, worker, r->server)) {
|
if (ap_proxy_connect_backend(__FUNCTION__, backend, worker, r->server)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: " PROXY_FUNCTION ": failed to make connection "
|
"failed to make connection to backend: %s:%u",
|
||||||
"to backend: %s:%u", backend->hostname, backend->port);
|
backend->hostname, backend->port);
|
||||||
status = HTTP_SERVICE_UNAVAILABLE;
|
status = HTTP_SERVICE_UNAVAILABLE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -551,7 +546,7 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
|
|||||||
cleanup:
|
cleanup:
|
||||||
if (backend) {
|
if (backend) {
|
||||||
backend->close = 1; /* always close the socket */
|
backend->close = 1; /* always close the socket */
|
||||||
ap_proxy_release_connection(PROXY_FUNCTION, backend, r->server);
|
ap_proxy_release_connection(__FUNCTION__, backend, r->server);
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@@ -385,6 +385,7 @@ PROXY_DECLARE(request_rec *)ap_proxy_make_fake_req(conn_rec *c, request_rec *r)
|
|||||||
rp->notes = apr_table_make(pool, 5);
|
rp->notes = apr_table_make(pool, 5);
|
||||||
|
|
||||||
rp->server = r->server;
|
rp->server = r->server;
|
||||||
|
rp->log = r->log;
|
||||||
rp->proxyreq = r->proxyreq;
|
rp->proxyreq = r->proxyreq;
|
||||||
rp->request_time = r->request_time;
|
rp->request_time = r->request_time;
|
||||||
rp->connection = c;
|
rp->connection = c;
|
||||||
@@ -502,8 +503,8 @@ PROXY_DECLARE(int) ap_proxyerror(request_rec *r, int statuscode, const char *mes
|
|||||||
apr_table_setn(r->notes, "verbose-error-to", apr_pstrdup(r->pool, "*"));
|
apr_table_setn(r->notes, "verbose-error-to", apr_pstrdup(r->pool, "*"));
|
||||||
|
|
||||||
r->status_line = apr_psprintf(r->pool, "%3.3u Proxy Error", statuscode);
|
r->status_line = apr_psprintf(r->pool, "%3.3u Proxy Error", statuscode);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "%s returned by %s", message,
|
||||||
"proxy: %s returned by %s", message, r->uri);
|
r->uri);
|
||||||
return statuscode;
|
return statuscode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -896,12 +897,14 @@ PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *c
|
|||||||
struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts;
|
struct noproxy_entry *npent = (struct noproxy_entry *) conf->noproxies->elts;
|
||||||
struct apr_sockaddr_t *conf_addr = npent[j].addr;
|
struct apr_sockaddr_t *conf_addr = npent[j].addr;
|
||||||
uri_addr = src_uri_addr;
|
uri_addr = src_uri_addr;
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: checking remote machine [%s] against [%s]", uri_addr->hostname, npent[j].name);
|
"checking remote machine [%s] against [%s]",
|
||||||
|
uri_addr->hostname, npent[j].name);
|
||||||
if ((npent[j].name && ap_strstr_c(uri_addr->hostname, npent[j].name))
|
if ((npent[j].name && ap_strstr_c(uri_addr->hostname, npent[j].name))
|
||||||
|| npent[j].name[0] == '*') {
|
|| npent[j].name[0] == '*') {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: connect to remote machine %s blocked: name %s matched", uri_addr->hostname, npent[j].name);
|
"connect to remote machine %s blocked: name %s "
|
||||||
|
"matched", uri_addr->hostname, npent[j].name);
|
||||||
return HTTP_FORBIDDEN;
|
return HTTP_FORBIDDEN;
|
||||||
}
|
}
|
||||||
while (conf_addr) {
|
while (conf_addr) {
|
||||||
@@ -911,11 +914,13 @@ PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *c
|
|||||||
char *uri_ip;
|
char *uri_ip;
|
||||||
apr_sockaddr_ip_get(&conf_ip, conf_addr);
|
apr_sockaddr_ip_get(&conf_ip, conf_addr);
|
||||||
apr_sockaddr_ip_get(&uri_ip, uri_addr);
|
apr_sockaddr_ip_get(&uri_ip, uri_addr);
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: ProxyBlock comparing %s and %s", conf_ip, uri_ip);
|
"ProxyBlock comparing %s and %s", conf_ip,
|
||||||
|
uri_ip);
|
||||||
if (!apr_strnatcasecmp(conf_ip, uri_ip)) {
|
if (!apr_strnatcasecmp(conf_ip, uri_ip)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
|
||||||
"proxy: connect to remote machine %s blocked: IP %s matched", uri_addr->hostname, conf_ip);
|
"connect to remote machine %s blocked: "
|
||||||
|
"IP %s matched", uri_addr->hostname, conf_ip);
|
||||||
return HTTP_FORBIDDEN;
|
return HTTP_FORBIDDEN;
|
||||||
}
|
}
|
||||||
uri_addr = uri_addr->next;
|
uri_addr = uri_addr->next;
|
||||||
@@ -1492,7 +1497,7 @@ static apr_status_t connection_cleanup(void *theconn)
|
|||||||
/* Sanity check: Did we already return the pooled connection? */
|
/* Sanity check: Did we already return the pooled connection? */
|
||||||
if (conn->inreslist) {
|
if (conn->inreslist) {
|
||||||
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool,
|
ap_log_perror(APLOG_MARK, APLOG_ERR, 0, conn->pool,
|
||||||
"proxy: Pooled connection 0x%pp for worker %s has been"
|
"Pooled connection 0x%pp for worker %s has been"
|
||||||
" already returned to the connection pool.", conn,
|
" already returned to the connection pool.", conn,
|
||||||
worker->s->name);
|
worker->s->name);
|
||||||
return APR_SUCCESS;
|
return APR_SUCCESS;
|
||||||
@@ -1556,7 +1561,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_ssl_connection_cleanup(proxy_conn_rec *conn
|
|||||||
|
|
||||||
rv = apr_brigade_length(bb, 0, &len);
|
rv = apr_brigade_length(bb, 0, &len);
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE3, rv, r,
|
||||||
"proxy: SSL cleanup brigade contained %"
|
"SSL cleanup brigade contained %"
|
||||||
APR_OFF_T_FMT " bytes of data.", len);
|
APR_OFF_T_FMT " bytes of data.", len);
|
||||||
}
|
}
|
||||||
apr_brigade_destroy(bb);
|
apr_brigade_destroy(bb);
|
||||||
@@ -1855,7 +1860,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
if (worker->tmutex == NULL) {
|
if (worker->tmutex == NULL) {
|
||||||
rv = apr_thread_mutex_create(&(worker->tmutex), APR_THREAD_MUTEX_DEFAULT, p);
|
rv = apr_thread_mutex_create(&(worker->tmutex), APR_THREAD_MUTEX_DEFAULT, p);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
||||||
"can not create worker thread mutex");
|
"can not create worker thread mutex");
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -1863,8 +1868,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
if (worker->cp == NULL)
|
if (worker->cp == NULL)
|
||||||
init_conn_pool(p, worker);
|
init_conn_pool(p, worker);
|
||||||
if (worker->cp == NULL) {
|
if (worker->cp == NULL) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
||||||
"can not create connection pool");
|
"can not create connection pool");
|
||||||
return APR_EGENERAL;
|
return APR_EGENERAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1880,7 +1885,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
apr_pool_cleanup_null);
|
apr_pool_cleanup_null);
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: initialized pool in child %" APR_PID_T_FMT " for (%s) min=%d max=%d smax=%d",
|
"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, worker->s->min,
|
||||||
worker->s->hmax, worker->s->smax);
|
worker->s->hmax, worker->s->smax);
|
||||||
|
|
||||||
@@ -1897,7 +1902,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser
|
|||||||
worker->cp->conn = conn;
|
worker->cp->conn = conn;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: initialized single connection worker in child %" APR_PID_T_FMT " for (%s)",
|
"initialized single connection worker in child %" APR_PID_T_FMT " for (%s)",
|
||||||
getpid(), worker->s->hostname);
|
getpid(), worker->s->hostname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1917,13 +1922,13 @@ PROXY_DECLARE(int) ap_proxy_retry_worker(const char *proxy_function,
|
|||||||
++worker->s->retries;
|
++worker->s->retries;
|
||||||
worker->s->status &= ~PROXY_WORKER_IN_ERROR;
|
worker->s->status &= ~PROXY_WORKER_IN_ERROR;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: worker for (%s) has been marked for retry",
|
"%s: worker for (%s) has been marked for retry",
|
||||||
proxy_function, worker->s->hostname);
|
proxy_function, worker->s->hostname);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: too soon to retry worker for (%s)",
|
"%s: too soon to retry worker for (%s)",
|
||||||
proxy_function, worker->s->hostname);
|
proxy_function, worker->s->hostname);
|
||||||
return DECLINED;
|
return DECLINED;
|
||||||
}
|
}
|
||||||
@@ -1945,7 +1950,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
|||||||
*worker = ap_proxy_get_worker(r->pool, NULL, conf, *url);
|
*worker = ap_proxy_get_worker(r->pool, NULL, conf, *url);
|
||||||
if (*worker) {
|
if (*worker) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: %s: found worker %s for %s",
|
"%s: found worker %s for %s",
|
||||||
(*worker)->s->scheme, (*worker)->s->name, *url);
|
(*worker)->s->scheme, (*worker)->s->name, *url);
|
||||||
|
|
||||||
*balancer = NULL;
|
*balancer = NULL;
|
||||||
@@ -1954,8 +1959,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
|||||||
else if (r->proxyreq == PROXYREQ_PROXY) {
|
else if (r->proxyreq == PROXYREQ_PROXY) {
|
||||||
if (conf->forward) {
|
if (conf->forward) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: *: found forward proxy worker for %s",
|
"*: found forward proxy worker for %s", *url);
|
||||||
*url);
|
|
||||||
*balancer = NULL;
|
*balancer = NULL;
|
||||||
*worker = conf->forward;
|
*worker = conf->forward;
|
||||||
access_status = OK;
|
access_status = OK;
|
||||||
@@ -1970,8 +1974,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
|||||||
else if (r->proxyreq == PROXYREQ_REVERSE) {
|
else if (r->proxyreq == PROXYREQ_REVERSE) {
|
||||||
if (conf->reverse) {
|
if (conf->reverse) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: *: found reverse proxy worker for %s",
|
"*: found reverse proxy worker for %s", *url);
|
||||||
*url);
|
|
||||||
*balancer = NULL;
|
*balancer = NULL;
|
||||||
*worker = conf->reverse;
|
*worker = conf->reverse;
|
||||||
access_status = OK;
|
access_status = OK;
|
||||||
@@ -1987,8 +1990,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker,
|
|||||||
else if (access_status == DECLINED && *balancer != NULL) {
|
else if (access_status == DECLINED && *balancer != NULL) {
|
||||||
/* All the workers are busy */
|
/* All the workers are busy */
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: all workers are busy. Unable to serve %s",
|
"all workers are busy. Unable to serve %s", *url);
|
||||||
*url);
|
|
||||||
access_status = HTTP_SERVICE_UNAVAILABLE;
|
access_status = HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
return access_status;
|
return access_status;
|
||||||
@@ -2028,10 +2030,8 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
|||||||
SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
SOCK_STREAM, 0, r->pool)) != APR_SUCCESS) {
|
||||||
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
||||||
ap_log_rerror(APLOG_MARK, loglevel, rv, r,
|
ap_log_rerror(APLOG_MARK, loglevel, rv, r,
|
||||||
"proxy: %s: error creating fam %d socket for target %s",
|
"%s: error creating fam %d socket for target %s",
|
||||||
proxy_function,
|
proxy_function, backend_addr->family, backend_name);
|
||||||
backend_addr->family,
|
|
||||||
backend_name);
|
|
||||||
/*
|
/*
|
||||||
* this could be an IPv6 address from the DNS but the
|
* this could be an IPv6 address from the DNS but the
|
||||||
* local machine won't give us an IPv6 socket; hopefully the
|
* local machine won't give us an IPv6 socket; hopefully the
|
||||||
@@ -2065,14 +2065,14 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
|
||||||
"proxy: %s: fam %d socket created to connect to %s",
|
"%s: fam %d socket created to connect to %s",
|
||||||
proxy_function, backend_addr->family, backend_name);
|
proxy_function, backend_addr->family, backend_name);
|
||||||
|
|
||||||
if (conf->source_address) {
|
if (conf->source_address) {
|
||||||
rv = apr_socket_bind(*newsock, conf->source_address);
|
rv = apr_socket_bind(*newsock, conf->source_address);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
|
||||||
"proxy: %s: failed to bind socket to local address",
|
"%s: failed to bind socket to local address",
|
||||||
proxy_function);
|
proxy_function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2085,10 +2085,8 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock,
|
|||||||
apr_socket_close(*newsock);
|
apr_socket_close(*newsock);
|
||||||
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
||||||
ap_log_rerror(APLOG_MARK, loglevel, rv, r,
|
ap_log_rerror(APLOG_MARK, loglevel, rv, r,
|
||||||
"proxy: %s: attempt to connect to %pI (%s) failed",
|
"%s: attempt to connect to %pI (%s) failed",
|
||||||
proxy_function,
|
proxy_function, backend_addr, backend_name);
|
||||||
backend_addr,
|
|
||||||
backend_name);
|
|
||||||
backend_addr = backend_addr->next;
|
backend_addr = backend_addr->next;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2110,7 +2108,7 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
|
|||||||
|
|
||||||
if (!PROXY_WORKER_IS_USABLE(worker)) {
|
if (!PROXY_WORKER_IS_USABLE(worker)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
||||||
"proxy: %s: disabled connection for (%s)",
|
"%s: disabled connection for (%s)",
|
||||||
proxy_function, worker->s->hostname);
|
proxy_function, worker->s->hostname);
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -2133,12 +2131,12 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function,
|
|||||||
|
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"proxy: %s: failed to acquire connection for (%s)",
|
"%s: failed to acquire connection for (%s)",
|
||||||
proxy_function, worker->s->hostname);
|
proxy_function, worker->s->hostname);
|
||||||
return HTTP_SERVICE_UNAVAILABLE;
|
return HTTP_SERVICE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: has acquired connection for (%s)",
|
"%s: has acquired connection for (%s)",
|
||||||
proxy_function, worker->s->hostname);
|
proxy_function, worker->s->hostname);
|
||||||
|
|
||||||
(*conn)->worker = worker;
|
(*conn)->worker = worker;
|
||||||
@@ -2153,7 +2151,7 @@ PROXY_DECLARE(int) ap_proxy_release_connection(const char *proxy_function,
|
|||||||
server_rec *s)
|
server_rec *s)
|
||||||
{
|
{
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: has released connection for (%s)",
|
"%s: has released connection for (%s)",
|
||||||
proxy_function, conn->worker->s->hostname);
|
proxy_function, conn->worker->s->hostname);
|
||||||
connection_cleanup(conn);
|
connection_cleanup(conn);
|
||||||
|
|
||||||
@@ -2190,9 +2188,8 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
|||||||
uri->port = apr_uri_port_of_scheme(uri->scheme);
|
uri->port = apr_uri_port_of_scheme(uri->scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: connecting %s to %s:%d", *url, uri->hostname,
|
"connecting %s to %s:%d", *url, uri->hostname, uri->port);
|
||||||
uri->port);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allocate these out of the specified connection pool
|
* allocate these out of the specified connection pool
|
||||||
@@ -2264,8 +2261,7 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
|||||||
}
|
}
|
||||||
else if (!worker->cp->addr) {
|
else if (!worker->cp->addr) {
|
||||||
if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
|
if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "lock");
|
||||||
"proxy: lock");
|
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2281,8 +2277,7 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
|||||||
worker->cp->pool);
|
worker->cp->pool);
|
||||||
conn->addr = worker->cp->addr;
|
conn->addr = worker->cp->addr;
|
||||||
if ((uerr = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
|
if ((uerr = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, uerr, r, "unlock");
|
||||||
"proxy: unlock");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -2316,9 +2311,8 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
|||||||
return ap_proxyerror(r, HTTP_FORBIDDEN,
|
return ap_proxyerror(r, HTTP_FORBIDDEN,
|
||||||
"Connect to remote machine blocked");
|
"Connect to remote machine blocked");
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
|
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
|
||||||
"proxy: connected %s to %s:%d", *url, conn->hostname,
|
"connected %s to %s:%d", *url, conn->hostname, conn->port);
|
||||||
conn->port);
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2411,7 +2405,7 @@ static apr_status_t send_http_connect(proxy_conn_rec *backend,
|
|||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: CONNECT: sending the CONNECT request for %s:%d "
|
"CONNECT: sending the CONNECT request for %s:%d "
|
||||||
"to the remote proxy %pI (%s)",
|
"to the remote proxy %pI (%s)",
|
||||||
forward->target_host, forward->target_port,
|
forward->target_host, forward->target_port,
|
||||||
backend->addr, backend->hostname);
|
backend->addr, backend->hostname);
|
||||||
@@ -2508,7 +2502,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|||||||
if (!(connected = is_socket_connected(conn->sock))) {
|
if (!(connected = is_socket_connected(conn->sock))) {
|
||||||
socket_cleanup(conn);
|
socket_cleanup(conn);
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: backend socket is disconnected.",
|
"%s: backend socket is disconnected.",
|
||||||
proxy_function);
|
proxy_function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2518,7 +2512,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|||||||
conn->scpool)) != APR_SUCCESS) {
|
conn->scpool)) != APR_SUCCESS) {
|
||||||
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
||||||
ap_log_error(APLOG_MARK, loglevel, rv, s,
|
ap_log_error(APLOG_MARK, loglevel, rv, s,
|
||||||
"proxy: %s: error creating fam %d socket for target %s",
|
"%s: error creating fam %d socket for target %s",
|
||||||
proxy_function,
|
proxy_function,
|
||||||
backend_addr->family,
|
backend_addr->family,
|
||||||
worker->s->hostname);
|
worker->s->hostname);
|
||||||
@@ -2570,7 +2564,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, s,
|
||||||
"proxy: %s: fam %d socket created to connect to %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);
|
||||||
|
|
||||||
if (conf->source_address_set) {
|
if (conf->source_address_set) {
|
||||||
@@ -2580,7 +2574,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|||||||
rv = apr_socket_bind(newsock, local_addr);
|
rv = apr_socket_bind(newsock, local_addr);
|
||||||
if (rv != APR_SUCCESS) {
|
if (rv != APR_SUCCESS) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
|
||||||
"proxy: %s: failed to bind socket to local address",
|
"%s: failed to bind socket to local address",
|
||||||
proxy_function);
|
proxy_function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2593,7 +2587,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|||||||
apr_socket_close(newsock);
|
apr_socket_close(newsock);
|
||||||
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
||||||
ap_log_error(APLOG_MARK, loglevel, rv, s,
|
ap_log_error(APLOG_MARK, loglevel, rv, s,
|
||||||
"proxy: %s: attempt to connect to %pI (%s) failed",
|
"%s: attempt to connect to %pI (%s) failed",
|
||||||
proxy_function,
|
proxy_function,
|
||||||
backend_addr,
|
backend_addr,
|
||||||
worker->s->hostname);
|
worker->s->hostname);
|
||||||
@@ -2628,7 +2622,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function,
|
|||||||
apr_socket_close(newsock);
|
apr_socket_close(newsock);
|
||||||
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR;
|
||||||
ap_log_error(APLOG_MARK, loglevel, rv, s,
|
ap_log_error(APLOG_MARK, loglevel, rv, s,
|
||||||
"proxy: %s: attempt to connect to %s:%d "
|
"%s: attempt to connect to %s:%d "
|
||||||
"via http CONNECT through %pI (%s) failed",
|
"via http CONNECT through %pI (%s) failed",
|
||||||
proxy_function,
|
proxy_function,
|
||||||
forward->target_host, forward->target_port,
|
forward->target_host, forward->target_port,
|
||||||
@@ -2698,7 +2692,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
|
|||||||
* closed the socket
|
* closed the socket
|
||||||
*/
|
*/
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0,
|
||||||
s, "proxy: %s: an error occurred creating a "
|
s, "%s: an error occurred creating a "
|
||||||
"new connection to %pI (%s)", proxy_function,
|
"new connection to %pI (%s)", proxy_function,
|
||||||
backend_addr, conn->hostname);
|
backend_addr, conn->hostname);
|
||||||
/* XXX: Will be closed when proxy_conn is closed */
|
/* XXX: Will be closed when proxy_conn is closed */
|
||||||
@@ -2710,7 +2704,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
|
|||||||
if (conn->is_ssl) {
|
if (conn->is_ssl) {
|
||||||
if (!ap_proxy_ssl_enable(conn->connection)) {
|
if (!ap_proxy_ssl_enable(conn->connection)) {
|
||||||
ap_log_error(APLOG_MARK, APLOG_ERR, 0,
|
ap_log_error(APLOG_MARK, APLOG_ERR, 0,
|
||||||
s, "proxy: %s: failed to enable ssl support "
|
s, "%s: failed to enable ssl support "
|
||||||
"for %pI (%s)", proxy_function,
|
"for %pI (%s)", proxy_function,
|
||||||
backend_addr, conn->hostname);
|
backend_addr, conn->hostname);
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
@@ -2722,7 +2716,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: connection complete to %pI (%s)",
|
"%s: connection complete to %pI (%s)",
|
||||||
proxy_function, backend_addr, conn->hostname);
|
proxy_function, backend_addr, conn->hostname);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2736,7 +2730,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function,
|
|||||||
if (rc != OK && rc != DONE) {
|
if (rc != OK && rc != DONE) {
|
||||||
conn->connection->aborted = 1;
|
conn->connection->aborted = 1;
|
||||||
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s,
|
||||||
"proxy: %s: pre_connection setup failed (%d)",
|
"%s: pre_connection setup failed (%d)",
|
||||||
proxy_function, rc);
|
proxy_function, rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@@ -2819,7 +2813,7 @@ ap_proxy_buckets_lifetime_transform(request_rec *r, apr_bucket_brigade *from,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
|
||||||
"proxy: Unhandled bucket type of type %s in"
|
"Unhandled bucket type of type %s in"
|
||||||
" ap_proxy_buckets_lifetime_transform", e->type->name);
|
" ap_proxy_buckets_lifetime_transform", e->type->name);
|
||||||
apr_bucket_delete(e);
|
apr_bucket_delete(e);
|
||||||
rv = APR_EGENERAL;
|
rv = APR_EGENERAL;
|
||||||
|
Reference in New Issue
Block a user