From de4fc3e07bdd86ea828dacc78c2d819cf0ecf116 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Fri, 18 Nov 2011 21:44:43 +0000 Subject: [PATCH] Backport r1203859: 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/branches/2.4.x@1203861 13f79535-47bb-0310-9956-ffa450edef68 --- modules/proxy/mod_proxy.c | 24 ++-- modules/proxy/mod_proxy_ajp.c | 48 +++---- modules/proxy/mod_proxy_balancer.c | 172 +++++++++++++------------ modules/proxy/mod_proxy_connect.c | 66 +++++----- modules/proxy/mod_proxy_fcgi.c | 84 ++++++------ modules/proxy/mod_proxy_fdpass.c | 16 +-- modules/proxy/mod_proxy_ftp.c | 142 ++++++++++---------- modules/proxy/mod_proxy_http.c | 199 ++++++++++++++--------------- modules/proxy/mod_proxy_scgi.c | 35 +++-- modules/proxy/proxy_util.c | 118 ++++++++--------- 10 files changed, 431 insertions(+), 473 deletions(-) diff --git a/modules/proxy/mod_proxy.c b/modules/proxy/mod_proxy.c index dfce1d7bfc..6ef6bcd596 100644 --- a/modules/proxy/mod_proxy.c +++ b/modules/proxy/mod_proxy.c @@ -904,7 +904,7 @@ static int proxy_handler(request_rec *r) "TRACE forbidden by server configuration"); apr_table_setn(r->notes, "verbose-error-to", "*"); 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; } @@ -922,7 +922,7 @@ static int proxy_handler(request_rec *r) "TRACE with request body is not allowed"); apr_table_setn(r->notes, "verbose-error-to", "*"); 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; } } @@ -996,8 +996,8 @@ static int proxy_handler(request_rec *r) strlen(ents[i].scheme)) == 0)) { /* handle the scheme */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Trying to run scheme_handler against proxy"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Trying to run scheme_handler against proxy"); access_status = proxy_run_scheme_handler(r, worker, conf, url, ents[i].hostname, @@ -1048,9 +1048,9 @@ static int proxy_handler(request_rec *r) */ /* handle the scheme */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "Running scheme %s handler (attempt %d)", - scheme, attempts); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Running scheme %s handler (attempt %d)", + scheme, attempts); AP_PROXY_RUN(r, worker, conf, url, attempts); access_status = proxy_run_scheme_handler(r, worker, conf, url, NULL, 0); @@ -1090,11 +1090,11 @@ static int proxy_handler(request_rec *r) max_attempts > attempts++); if (DECLINED == access_status) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy: No protocol handler was valid for the URL %s. " - "If you are using a DSO version of mod_proxy, make sure " - "the proxy submodules are included in the configuration " - "using LoadModule.", r->uri); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "No protocol handler was valid for the URL %s. " + "If you are using a DSO version of mod_proxy, make sure " + "the proxy submodules are included in the configuration " + "using LoadModule.", r->uri); access_status = HTTP_INTERNAL_SERVER_ERROR; goto cleanup; } diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c index 3465a97dab..f965d26323 100644 --- a/modules/proxy/mod_proxy_ajp.c +++ b/modules/proxy/mod_proxy_ajp.c @@ -43,7 +43,7 @@ static int proxy_ajp_canon(request_rec *r, char *url) } ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: AJP: canonicalising URL %s", url); + "AJP: canonicalising URL %s", url); /* * do syntactic check. @@ -211,7 +211,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if (status != APR_SUCCESS) { conn->close++; 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->s->hostname); 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 */ conn->close++; 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; } @@ -248,7 +248,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if (tenc && (strcasecmp(tenc, "chunked") == 0)) { /* The AJP protocol does not want body data yet */ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: request is chunked"); + "request is chunked"); } else { /* Get client provided Content-Length header */ 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 */ conn->close++; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: ap_get_brigade failed"); + "ap_get_brigade failed"); apr_brigade_destroy(input_brigade); return HTTP_BAD_REQUEST; } @@ -268,12 +268,12 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, /* have something */ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: APR_BUCKET_IS_EOS"); + "APR_BUCKET_IS_EOS"); } /* Try to send something */ 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); 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++; apr_brigade_destroy(input_brigade); ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: apr_brigade_flatten"); + "apr_brigade_flatten"); return HTTP_INTERNAL_SERVER_ERROR; } apr_brigade_cleanup(input_brigade); 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) { status = ajp_send_data_msg(conn->sock, msg, bufsiz); 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++; apr_brigade_destroy(input_brigade); 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->s->hostname); /* @@ -311,7 +311,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, } else if (content_length > 0) { ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: read zero bytes, expecting" + "read zero bytes, expecting" " %" APR_OFF_T_FMT " bytes", content_length); /* @@ -337,7 +337,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, conn->close++; apr_brigade_destroy(input_brigade); 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->s->hostname); @@ -384,7 +384,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, bufsiz = 0; havebody = 0; ap_log_error(APLOG_MARK, APLOG_DEBUG, status, r->server, - "proxy: APR_BUCKET_IS_EOS"); + "APR_BUCKET_IS_EOS"); } else { status = ap_get_brigade(r->input_filters, input_brigade, AP_MODE_READBYTES, @@ -438,7 +438,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, */ backend_failed = 1; ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: Backend sent headers twice."); + "Backend sent headers twice."); break; } /* 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, output_brigade) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: error processing body.%s", + "error processing body.%s", r->connection->aborted ? " Client aborted connection." : ""); 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, output_brigade) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: error processing end"); + "error processing end"); output_failed = 1; } /* 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) { 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); /* We had a failure: Close connection to backend */ conn->close++; @@ -610,7 +610,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, } else if (!request_ended) { 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 */ conn->close++; backend_failed = 1; @@ -625,7 +625,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, } else { 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->s->hostname); @@ -644,7 +644,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if (backend_failed) { 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->s->hostname); /* @@ -727,11 +727,11 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker, if (strncasecmp(url, "ajp:", 4) != 0) { ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: AJP: declining URL %s", url); + "AJP: declining URL %s", url); return DECLINED; } 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 */ 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 */ if (ap_proxy_connect_backend(scheme, backend, worker, 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); status = HTTP_SERVICE_UNAVAILABLE; break; @@ -781,7 +781,7 @@ static int proxy_ajp_handler(request_rec *r, proxy_worker *worker, if (status != APR_SUCCESS) { backend->close++; 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->s->hostname); status = HTTP_SERVICE_UNAVAILABLE; diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 8d8f230672..cb58afae99 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -67,8 +67,7 @@ static int proxy_balancer_canon(request_rec *r, char *url) return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: BALANCER: canonicalising URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url); /* do syntatic check. * 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 */ *route = get_path_param(r->pool, *url, balancer->s->sticky_path, balancer->s->scolonsep); if (*route) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: BALANCER: Found value %s for " - "stickysession %s", *route, balancer->s->sticky_path); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Found value %s for stickysession %s", + *route, balancer->s->sticky_path); *sticky_used = balancer->s->sticky_path; } else { *route = get_cookie_param(r, balancer->s->sticky); if (*route) { *sticky_used = balancer->s->sticky; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: BALANCER: Found value %s for " - "stickysession %s", *route, balancer->s->sticky); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Found value %s for stickysession %s", + *route, balancer->s->sticky); } } /* @@ -297,8 +296,7 @@ static proxy_worker *find_session_route(proxy_balancer *balancer, if ((*route) && ((*route = strchr(*route, '.')) != NULL )) (*route)++; if ((*route) && (**route)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: BALANCER: Found route %s", *route); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "Found route %s", *route); /* We have a route in path or in cookie * 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. */ apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1"); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: BALANCER: Route changed from %s to %s", - *route, worker->s->route); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "Route changed from %s to %s", + *route, worker->s->route); } return worker; } @@ -326,8 +324,9 @@ static proxy_worker *find_best_worker(proxy_balancer *balancer, apr_status_t rv; if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Lock failed for find_best_worker()", balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Lock failed for find_best_worker()", + balancer->name); return NULL; } @@ -337,8 +336,9 @@ static proxy_worker *find_best_worker(proxy_balancer *balancer, candidate->s->elected++; if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for find_best_worker()", balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for find_best_worker()", + balancer->name); } if (candidate == NULL) { @@ -428,7 +428,7 @@ static void force_recovery(proxy_balancer *balancer, server_rec *s) ++(*worker)->s->retries; (*worker)->s->status &= ~PROXY_WORKER_IN_ERROR; 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); } } @@ -459,9 +459,8 @@ static int proxy_balancer_pre_request(proxy_worker **worker, * XXX: perhaps we need the process lock here */ if ((rv = PROXY_THREAD_LOCK(*balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Lock failed for pre_request", - (*balancer)->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Lock failed for pre_request", (*balancer)->name); return DECLINED; } @@ -521,34 +520,34 @@ static int proxy_balancer_pre_request(proxy_worker **worker, workers++; } if (member_of) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: BALANCER: (%s). All workers are in error state for route (%s)", - (*balancer)->name, route); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "%s: All workers are in error state for route (%s)", + (*balancer)->name, route); if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for pre_request", - (*balancer)->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for pre_request", + (*balancer)->name); } return HTTP_SERVICE_UNAVAILABLE; } } if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for pre_request", - (*balancer)->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for pre_request", + (*balancer)->name); } if (!*worker) { runtime = find_best_worker(*balancer, r); if (!runtime) { if ((*balancer)->workers->nelts) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: BALANCER: (%s). All workers are in error state", - (*balancer)->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "%s: All workers are in error state", + (*balancer)->name); } else { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: BALANCER: (%s). No workers in balancer", - (*balancer)->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "%s: No workers in balancer", + (*balancer)->name); } return HTTP_SERVICE_UNAVAILABLE; @@ -594,9 +593,9 @@ static int proxy_balancer_pre_request(proxy_worker **worker, apr_table_setn(r->subprocess_env, "BALANCER_SESSION_ROUTE", route); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: BALANCER (%s) worker (%s) rewritten to %s", - (*balancer)->name, (*worker)->s->name, *url); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "%s: worker (%s) rewritten to %s", + (*balancer)->name, (*worker)->s->name, *url); return access_status; } @@ -610,9 +609,9 @@ static int proxy_balancer_post_request(proxy_worker *worker, apr_status_t rv; if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Lock failed for post_request", - balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Lock failed for post_request", + balancer->name); 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++) { int val = ((int *)balancer->errstatuses->elts)[i]; if (r->status == val) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Forcing recovery for worker (%s), failonstatus %d", - balancer->name, worker->s->name, val); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Forcing recovery for worker (%s), " + "failonstatus %d", + balancer->name, worker->s->name, val); worker->s->status |= PROXY_WORKER_IN_ERROR; worker->s->error_time = apr_time_now(); break; @@ -632,12 +632,11 @@ static int proxy_balancer_post_request(proxy_worker *worker, } if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for post_request", - balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for post_request", balancer->name); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy_balancer_post_request for (%s)", balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "proxy_balancer_post_request for (%s)", balancer->name); if (worker && 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", AP_SLOTMEM_PROVIDER_VERSION); 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_SLOTMEM_PROVIDER_GROUP); return !OK; @@ -921,21 +920,21 @@ static int balancer_handler(request_rec *r) balancer = (proxy_balancer *)conf->balancers->elts; for (i = 0; i < conf->balancers->nelts; i++, balancer++) { if ((rv = PROXY_THREAD_LOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Lock failed for balancer_handler", - balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Lock failed for balancer_handler", + balancer->name); } ap_proxy_sync_balancer(balancer, r->server, conf); if ((rv = PROXY_THREAD_UNLOCK(balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for balancer_handler", - balancer->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for balancer_handler", + balancer->name); } } if (r->args && (r->method_number == M_GET)) { 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); } @@ -982,7 +981,7 @@ static int balancer_handler(request_rec *r) const char *val; 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"))) { int ival = atoi(val); @@ -1032,7 +1031,8 @@ static int balancer_handler(request_rec *r) if (bsel && ok2change) { const char *val; 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 ((strlen(val) < (sizeof(bsel->s->lbpname)-1)) && 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); if (!nworker && storage->num_free_slots(bsel->slot)) { if ((rv = PROXY_GLOBAL_LOCK(bsel)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Lock failed for adding worker", - bsel->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Lock failed for adding worker", + bsel->name); } ret = ap_proxy_define_worker(conf->pool, &nworker, bsel, conf, val, 0); if (!ret) { @@ -1096,38 +1096,42 @@ static int balancer_handler(request_rec *r) proxy_worker_shared *shm; PROXY_COPY_CONF_PARAMS(nworker, conf); 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) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for adding worker", - bsel->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for adding worker", + bsel->name); } return HTTP_BAD_REQUEST; } 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) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for adding worker", - bsel->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for adding worker", + bsel->name); } return HTTP_BAD_REQUEST; } 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) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for adding worker", - bsel->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for adding worker", + bsel->name); } return HTTP_BAD_REQUEST; } 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) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for adding worker", - bsel->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for adding worker", + bsel->name); } return HTTP_BAD_REQUEST; } @@ -1137,9 +1141,9 @@ static int balancer_handler(request_rec *r) ap_proxy_set_wstatus('D', 1, nworker); } if ((rv = PROXY_GLOBAL_UNLOCK(bsel)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for adding worker", - bsel->name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "%s: Unlock failed for adding worker", + bsel->name); } } @@ -1148,7 +1152,7 @@ static int balancer_handler(request_rec *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")) { 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; storage->attach(&(conf->slot), conf->id, &size, &num, p); 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? */ } } diff --git a/modules/proxy/mod_proxy_connect.c b/modules/proxy/mod_proxy_connect.c index 4ccd6ca42f..c60bdcf2e7 100644 --- a/modules/proxy/mod_proxy_connect.c +++ b/modules/proxy/mod_proxy_connect.c @@ -138,8 +138,7 @@ static int proxy_connect_canon(request_rec *r, char *url) if (r->method_number != M_CONNECT) { return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: CONNECT: canonicalising URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url); return OK; } @@ -166,7 +165,7 @@ static int proxy_connect_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o, len = -1; apr_brigade_length(bb, 0, &len); 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); #endif 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 { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: CONNECT: error on %s - ap_pass_brigade", + "error on %s - ap_pass_brigade", name); } } else if (!APR_STATUS_IS_EAGAIN(rv)) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, - "proxy: CONNECT: error on %s - ap_get_brigade", + "error on %s - ap_get_brigade", name); } } while (rv == APR_SUCCESS); @@ -225,12 +224,10 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, /* is this for us? */ if (r->method_number != M_CONNECT) { - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: CONNECT: declining URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "declining URL %s", url); return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: CONNECT: serving URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "serving URL %s", url); /* @@ -246,9 +243,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, NULL)); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: CONNECT: connecting %s to %s:%d", url, uri.hostname, - uri.port); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "connecting %s to %s:%d", url, uri.hostname, uri.port); /* do a DNS lookup for the destination host */ 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; connect_addr = uri_addr; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: CONNECT: connecting to remote proxy %s on port %d", - connectname, connectport); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "connecting to remote proxy %s on port %d", + connectname, connectport); /* check if ProxyBlock directive on this host */ 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 */ - ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, - "proxy: CONNECT: setting up poll()"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "setting up poll()"); if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) { apr_socket_close(sock); ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: CONNECT: error apr_pollset_create()"); + "error apr_pollset_create()"); return HTTP_INTERNAL_SERVER_ERROR; } @@ -359,7 +354,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, if (!backconn) { /* peer reset */ 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); apr_socket_close(sock); 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) { backconn->aborted = 1; 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; } ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, - "proxy: CONNECT: connection complete to %pI (%s)", + "connection complete to %pI (%s)", connect_addr, connectname); apr_table_setn(r->notes, "proxy-source-port", apr_psprintf(r->pool, "%hu", backconn->local_addr->port)); @@ -385,9 +380,8 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, if (proxyport) { /* FIXME: Error checking ignored. */ - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy: CONNECT: sending the CONNECT request" - " to the remote proxy"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, + "sending the CONNECT request to the remote proxy"); ap_fprintf(backconn->output_filters, bb, "CONNECT %s HTTP/1.0" CRLF, r->uri); 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); } else { - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: CONNECT: Returning 200 OK Status"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "Returning 200 OK"); nbytes = apr_snprintf(buffer, sizeof(buffer), "HTTP/1.0 200 Connection Established" CRLF); ap_xlate_proto_to_ascii(buffer, nbytes); @@ -418,8 +411,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, #endif } - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy: CONNECT: setting up poll()"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "setting up poll()"); /* * Step Four: Handle Data Transfer @@ -443,12 +435,12 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, continue; } 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; } #ifdef DEBUGGING - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: CONNECT: woke from poll(), i=%d", pollcnt); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "woke from poll(), i=%d", pollcnt); #endif 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) { #ifdef DEBUGGING ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: CONNECT: sock was readable"); + "sock was readable"); #endif 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)) { rv = APR_EPIPE; ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, - "proxy: CONNECT: err/hup on backconn"); + "err/hup on backconn"); } if (rv != APR_SUCCESS) client_error = 1; @@ -477,7 +469,7 @@ static int proxy_connect_handler(request_rec *r, proxy_worker *worker, if (pollevent & APR_POLLIN) { #ifdef DEBUGGING ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: CONNECT: client was readable"); + "client was readable"); #endif 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 { rv = APR_EBADF; 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, - "proxy: CONNECT: finished with poll() - cleaning up"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, + "finished with poll() - cleaning up"); /* * Step Five: Clean Up diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c index d0a214366b..b8d9b84237 100644 --- a/modules/proxy/mod_proxy_fcgi.c +++ b/modules/proxy/mod_proxy_fcgi.c @@ -86,8 +86,8 @@ static int proxy_fcgi_canon(request_rec *r, char *url) return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: FCGI: canonicalising URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "canonicalising URL %s", url); err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port); if (err) { @@ -117,13 +117,13 @@ static int proxy_fcgi_canon(request_rec *r, char *url) path, NULL); 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")) { r->path_info = apr_pstrcat(r->pool, "/", path, NULL); 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; @@ -318,7 +318,7 @@ static apr_status_t send_environment(proxy_conn_rec *conn, request_rec *r, #ifdef FCGI_DUMP_ENV_VARS 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); #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 */ if (envlen > FCGI_MAX_ENV_SIZE) { 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); break; } @@ -499,8 +499,8 @@ static void dump_header_to_log(request_rec *r, unsigned char fheader[], if (i >= 20) { i = 0; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "HEADER: %s %s", asc_line, hex_line); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "HEADER: %s %s", asc_line, hex_line); memset(asc_line, 0, sizeof(asc_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) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, "HEADER: %s %s", - asc_line, hex_line); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HEADER: %s %s", + 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 } @@ -671,10 +671,10 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf, dump_header_to_log(r, farray, readbuflen); if (readbuflen != FCGI_HEADER_LEN) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: Failed to read entire header " - "got %" APR_SIZE_T_FMT " wanted %d", - readbuflen, FCGI_HEADER_LEN); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Failed to read entire header " + "got %" APR_SIZE_T_FMT " wanted %d", + readbuflen, FCGI_HEADER_LEN); rv = APR_EINVAL; break; } @@ -682,9 +682,8 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf, fcgi_header_from_array(&header, farray); if (header.version != FCGI_VERSION) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: Got bogus version %d", - (int) header.version); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Got bogus version %d", (int) header.version); rv = APR_EINVAL; break; } @@ -695,9 +694,9 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf, rid |= header.requestIdB0; if (rid != request_id) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: Got bogus rid %d, expected %d", - rid, request_id); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Got bogus rid %d, expected %d", + rid, request_id); rv = APR_EINVAL; break; } @@ -750,8 +749,8 @@ recv_again: tmp_b = apr_bucket_eos_create(c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(ob, tmp_b); ap_pass_brigade(r->output_filters, ob); - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: Error parsing script headers"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Error parsing script headers"); r->status = status; rv = APR_EINVAL; break; @@ -829,8 +828,8 @@ recv_again: case FCGI_STDERR: /* TODO: Should probably clean up this logging a bit... */ if (clen) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: Got error '%s'", readbuf); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Got error '%s'", readbuf); } if (clen > readbuflen) { @@ -844,8 +843,8 @@ recv_again: break; default: - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: Got bogus record %d", type); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Got bogus record %d", type); break; } @@ -891,9 +890,8 @@ static int fcgi_do_request(apr_pool_t *p, request_rec *r, /* Step 1: Send FCGI_BEGIN_REQUEST */ rv = send_begin_request(conn, request_id); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FCGI: Failed Writing Request to %s:", - server_portstr); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "Failed Writing Request to %s:", server_portstr); conn->close = 1; 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 */ rv = send_environment(conn, r, request_id); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FCGI: Failed writing Environment to %s:", - server_portstr); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "Failed writing Environment to %s:", server_portstr); conn->close = 1; 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. */ rv = dispatch(conn, conf, r, request_id); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FCGI: Error dispatching request to %s:", - server_portstr); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "Error dispatching request to %s:", server_portstr); conn->close = 1; 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)); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FCGI: url: %s proxyname: %s proxyport: %d", + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "url: %s proxyname: %s proxyport: %d", url, proxyname, proxyport); if (strncasecmp(url, "fcgi:", 5) == 0) { url += 5; } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FCGI: declining URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "declining URL %s", url); return DECLINED; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FCGI: serving URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "serving URL %s", url); /* Create space for state information */ if (! backend) { @@ -991,9 +985,9 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker, /* Step Two: Make the Connection */ if (ap_proxy_connect_backend(FCGI_SCHEME, backend, worker, r->server)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: FCGI: failed to make connection to backend: %s", - backend->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "failed to make connection to backend: %s", + backend->hostname); status = HTTP_SERVICE_UNAVAILABLE; goto cleanup; } diff --git a/modules/proxy/mod_proxy_fdpass.c b/modules/proxy/mod_proxy_fdpass.c index 0a170f5c78..83b0e98a5f 100644 --- a/modules/proxy/mod_proxy_fdpass.c +++ b/modules/proxy/mod_proxy_fdpass.c @@ -50,7 +50,7 @@ static int proxy_fdpass_canon(request_rec *r, char *url) r->filename = apr_pstrcat(r->pool, "proxy:fd://", path, NULL); 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; } @@ -196,8 +196,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, if (rv != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FD: Failed to connect to '%s'", - url); + "Failed to connect to '%s'", url); return HTTP_INTERNAL_SERVER_ERROR; } @@ -210,8 +209,8 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, if (!flush) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FD: Unable to find configured flush " - "provider '%s'", flush_method); + "Unable to find configured flush provider '%s'", + flush_method); 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); if (rv != APR_SUCCESS) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FD: send_socket failed:"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, "send_socket failed:"); return HTTP_INTERNAL_SERVER_ERROR; } @@ -240,7 +238,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker, r->connection->pool); if (rv != APR_SUCCESS) { 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; } ap_set_core_module_config(r->connection->conn_config, dummy); @@ -267,7 +265,7 @@ static int standard_flush(request_rec *r) if (status != OK) { ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, - "proxy: FD: ap_pass_brigade failed:"); + "ap_pass_brigade failed:"); return status; } diff --git a/modules/proxy/mod_proxy_ftp.c b/modules/proxy/mod_proxy_ftp.c index 529f1f25fc..fdf87c1765 100644 --- a/modules/proxy/mod_proxy_ftp.c +++ b/modules/proxy/mod_proxy_ftp.c @@ -228,8 +228,7 @@ static int proxy_ftp_canon(request_rec *r, char *url) } def_port = apr_uri_port_of_scheme("ftp"); - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: FTP: canonicalising URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "canonicalising URL %s", url); port = def_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, - "proxy: buffer, ' '); if (filename == NULL) { /* Line is broken. Ignore it. */ - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy_ftp: could not parse line %s", ctx->buffer); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "proxy_ftp: could not parse line %s", + ctx->buffer); /* erase buffer for next time around */ ctx->buffer[0] = 0; continue; /* while state is BODY */ @@ -745,8 +745,7 @@ proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl, *crlf = '\0'; if (strncmp(message,"PASS ", 5) == 0) strcpy(&message[5], "****"); - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy:>FTP: %s", message); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, ">%s", 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 || (crlf = strchr(message, '\n')) != NULL) *crlf = '\0'; - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy:pool, message); @@ -847,7 +845,7 @@ static int ftp_unauthorized(request_rec *r, int log_it) */ if (log_it) 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, &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? */ if (proxyhost) { - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: declining URL %s - proxyhost %s specified:", url, proxyhost); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, + "declining URL %s - proxyhost %s specified:", url, + proxyhost); return DECLINED; /* proxy connections are via HTTP */ } if (strncasecmp(url, "ftp:", 4)) { - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: declining URL %s - not ftp:", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, + "declining URL %s - not ftp:", url); return DECLINED; /* only interested in FTP */ } - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: serving URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "serving URL %s", url); /* @@ -1032,14 +1030,13 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, password = "apache-proxy@"; } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: connecting %s to %s:%d", url, connectname, connectport); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "connecting %s to %s:%d", url, connectname, connectport); if (worker->s->is_address_reusable) { if (!worker->cp->addr) { if ((err = PROXY_THREAD_LOCK(worker->balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, - "proxy: FTP: lock"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "lock"); 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) { worker->cp->addr = connect_addr; if ((uerr = PROXY_THREAD_UNLOCK(worker->balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server, - "proxy: FTP: unlock"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, uerr, r, "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)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: an error occurred creating a new connection to %pI (%s)", - connect_addr, connectname); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "an error occurred creating a new connection to %pI (%s)", + connect_addr, connectname); proxy_ftp_cleanup(r, backend); return HTTP_SERVICE_UNAVAILABLE; } @@ -1122,8 +1118,8 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, origin = backend->connection; sock = backend->sock; - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: FTP: control connection complete"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "control connection complete"); /* @@ -1338,13 +1334,12 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, if (data_port) { apr_sockaddr_t *epsv_addr; - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: FTP: EPSV contacting remote host on port %d", - data_port); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "EPSV contacting remote host on port %d", data_port); 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, - "proxy: FTP: error creating EPSV socket"); + "error creating EPSV socket"); proxy_ftp_cleanup(r, backend); 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, conf->recv_buffer_size))) { 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); if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) { 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 */ @@ -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); rv = apr_socket_connect(data_sock, epsv_addr); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FTP: EPSV attempt to connect to %pI failed - Firewall/NAT?", epsv_addr); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "EPSV attempt to connect to %pI failed - " + "Firewall/NAT?", epsv_addr); return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, apr_psprintf(r->pool, "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_port_t pasvport = (p1 << 8) + p0; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: PASV contacting host %d.%d.%d.%d:%d", - h3, h2, h1, h0, pasvport); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "PASV contacting host %d.%d.%d.%d:%d", + h3, h2, h1, h0, pasvport); 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, - "proxy: error creating PASV socket"); + "error creating PASV socket"); proxy_ftp_cleanup(r, backend); 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, conf->recv_buffer_size))) { 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); if (rv != APR_SUCCESS && rv != APR_ENOTIMPL) { 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 */ 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); if (rv != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: FTP: PASV attempt to connect to %pI failed - Firewall/NAT?", pasv_addr); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "PASV attempt to connect to %pI failed - Firewall/NAT?", pasv_addr); return ftp_proxyerror(r, backend, HTTP_BAD_GATEWAY, apr_psprintf(r->pool, "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) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error creating local socket"); + "error creating local socket"); proxy_ftp_cleanup(r, backend); return HTTP_INTERNAL_SERVER_ERROR; } @@ -1488,7 +1487,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, != APR_SUCCESS) { #ifndef _OSD_POSIX /* BS2000 has this option "always on" */ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: FTP: error setting reuseaddr option"); + "error setting reuseaddr option"); proxy_ftp_cleanup(r, backend); return HTTP_INTERNAL_SERVER_ERROR; #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) { 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); 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 */ if ((rv = apr_socket_listen(local_sock, 2)) != APR_SUCCESS) { 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); 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 */ } else if (rc == 550) { /* Not a regular file */ - ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server, - "proxy: FTP: SIZE shows this is a directory"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r, + "SIZE shows this is a directory"); dirlisting = 1; rc = proxy_ftp_command(apr_pstrcat(p, "CWD ", 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"); } if (rc == 550) { - ap_log_error(APLOG_MARK, APLOG_TRACE4, 0, r->server, - "proxy: FTP: RETR failed, trying LIST instead"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE4, 0, r, + "RETR failed, trying LIST instead"); /* Directory Listings should always be fetched in ASCII mode */ dirlisting = 1; @@ -1805,14 +1804,14 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, if (xfer_type != 'A' && size != NULL) { /* We "trust" the ftp server to really serve (size) bytes... */ apr_table_setn(r->headers_out, "Content-Length", size); - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: Content-Length set to %s", size); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, + "Content-Length set to %s", size); } } if (r->content_type) { apr_table_setn(r->headers_out, "Content-Type", r->content_type); - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: Content-Type set to %s", r->content_type); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, + "Content-Type set to %s", r->content_type); } #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]; apr_rfc822_date(datestr, mtime); apr_table_set(r->headers_out, "Last-Modified", datestr); - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: Last-Modified set to %s", datestr); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, + "Last-Modified set to %s", datestr); } #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)*/ if (r->content_encoding != NULL && r->content_encoding[0] != '\0') { - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: Content-Encoding set to %s", - r->content_encoding); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, + "Content-Encoding set to %s", 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 { 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); 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 socket */ - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: an error occurred creating the transfer connection"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "an error occurred creating the transfer connection"); proxy_ftp_cleanup(r, backend); 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 */ rc = ap_run_pre_connection(data, data_sock); if (rc != OK && rc != DONE) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: pre_connection setup failed (%d)", - rc); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "pre_connection setup failed (%d)", rc); data->aborted = 1; proxy_ftp_cleanup(r, backend); return rc; @@ -1908,8 +1905,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, apr_bucket *e; int finish = FALSE; - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: start body send"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "start body send"); /* read the body, pass it to the output 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); } data_sock = NULL; - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: data connection closed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "data connection closed"); /* signal that we must leave */ finish = TRUE; } @@ -1971,15 +1967,13 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, break; } } - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: FTP: end body send"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "end body send"); } if (data_sock) { ap_flush_conn(data); apr_socket_close(data_sock); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: FTP: data connection closed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "data connection closed"); } /* Retrieve the final response for the RETR or LIST commands */ diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 4e897d87c6..cd61563ae6 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -53,8 +53,8 @@ static int proxy_http_canon(request_rec *r, char *url) } def_port = apr_uri_port_of_scheme(scheme); - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: HTTP: canonicalising URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, + "HTTP: canonicalising URL %s", url); /* do syntatic check. * 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); if (err) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "error parsing URL %s: %s", - url, err); + "error parsing URL %s: %s", url, err); return HTTP_BAD_REQUEST; } @@ -268,9 +267,9 @@ static int pass_brigade(apr_bucket_alloc_t *bucket_alloc, p_conn->worker->s->transferred += transferred; status = ap_pass_brigade(origin->output_filters, bb); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: pass request body failed to %pI (%s)", - p_conn->addr, p_conn->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "pass request body failed to %pI (%s)", + p_conn->addr, p_conn->hostname); if (origin->aborted) { 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) { 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); return HTTP_BAD_REQUEST; } @@ -479,7 +478,7 @@ static int stream_reqbody_cl(apr_pool_t *p, */ if (bytes_streamed > cl_val) { 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 ")", bytes_streamed, cl_val); return HTTP_INTERNAL_SERVER_ERROR; @@ -531,9 +530,9 @@ static int stream_reqbody_cl(apr_pool_t *p, } if (bytes_streamed != cl_val) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: client %s given Content-Length did not match" - " number of body bytes read", r->connection->remote_ip); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "client %s given Content-Length did not match" + " number of body bytes read", r->connection->remote_ip); return HTTP_BAD_REQUEST; } @@ -589,10 +588,9 @@ static int spool_reqbody_cl(apr_pool_t *p, * temporary file on disk. */ if (bytes_spooled + bytes > limit) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: Request body is larger than the" - " configured limit of %" APR_OFF_T_FMT ".", - limit); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "Request body is larger than the configured " + "limit of %" APR_OFF_T_FMT, limit); return HTTP_REQUEST_ENTITY_TOO_LARGE; } /* 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); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: search for temporary directory failed"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "search for temporary directory failed"); return HTTP_INTERNAL_SERVER_ERROR; } apr_filepath_merge(&template, temp_dir, @@ -611,9 +609,9 @@ static int spool_reqbody_cl(apr_pool_t *p, APR_FILEPATH_NATIVE, p); status = apr_file_mktemp(&tmpfile, template, 0, p); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: creation of temporary file in directory %s failed", - temp_dir); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "creation of temporary file in directory " + "%s failed", temp_dir); 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) { tmpfile_name = "(unknown)"; } - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: write to temporary file %s failed", - tmpfile_name); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "write to temporary file %s failed", + tmpfile_name); return HTTP_INTERNAL_SERVER_ERROR; } 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) { hostname = r->server->server_hostname; 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 " "forcing hostname to be %s for uri %s", - hostname, - r->uri ); + hostname, r->uri); } 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 */ if (old_te_val && strcasecmp(old_te_val, "chunked") != 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: %s Transfer-Encoding is not supported", - old_te_val); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "%s Transfer-Encoding is not supported", old_te_val); return HTTP_INTERNAL_SERVER_ERROR; } if (old_cl_val && old_te_val) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, APR_ENOTIMPL, r->server, - "proxy: client %s (%s) requested Transfer-Encoding " - "chunked body with Content-Length (C-L ignored)", - c->remote_ip, c->remote_host ? c->remote_host: ""); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "client %s (%s) requested Transfer-Encoding " + "chunked body with Content-Length (C-L ignored)", + c->remote_ip, c->remote_host ? c->remote_host: ""); apr_table_unset(r->headers_in, "Content-Length"); old_cl_val = NULL; 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, MAX_MEM_SPOOL - bytes_read); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: prefetch request body failed to %pI (%s)" - " from %s (%s)", - p_conn->addr, p_conn->hostname ? p_conn->hostname: "", - c->remote_ip, c->remote_host ? c->remote_host: ""); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "prefetch request body failed to %pI (%s)" + " from %s (%s)", + p_conn->addr, p_conn->hostname ? p_conn->hostname: "", + c->remote_ip, c->remote_host ? c->remote_host: ""); 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); if (status != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, - "proxy: processing prefetched request body failed" - " to %pI (%s) from %s (%s)", - p_conn->addr, p_conn->hostname ? p_conn->hostname: "", - c->remote_ip, c->remote_host ? c->remote_host: ""); + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, + "processing prefetched request body failed" + " to %pI (%s) from %s (%s)", + p_conn->addr, p_conn->hostname ? p_conn->hostname: "", + c->remote_ip, c->remote_host ? c->remote_host: ""); return HTTP_INTERNAL_SERVER_ERROR; } @@ -1189,13 +1185,10 @@ skip_body: if (rv != OK) { /* apr_status_t value has been logged in lower level method */ - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: pass request body failed to %pI (%s)" - " from %s (%s)", - p_conn->addr, - p_conn->hostname ? p_conn->hostname: "", - c->remote_ip, - c->remote_host ? c->remote_host: ""); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "pass request body failed to %pI (%s) from %s (%s)", + p_conn->addr, p_conn->hostname ? p_conn->hostname: "", + c->remote_ip, c->remote_host ? c->remote_host: ""); return rv; } @@ -1298,23 +1291,24 @@ static void ap_proxy_read_headers(request_rec *r, request_rec *rr, * the first line of the response. */ if (saw_headers) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy: Starting body due to bogus non-header in headers " - "returned by %s (%s)", r->uri, r->method); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "Starting body due to bogus non-header " + "in headers returned by %s (%s)", + r->uri, r->method); *pread_len = len; return ; } else { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy: No HTTP headers " - "returned by %s (%s)", r->uri, r->method); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "No HTTP headers returned by %s (%s)", + r->uri, r->method); return ; } } } /* this is the psc->badopt == bad_ignore case */ - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy: Ignoring bogus HTTP header " - "returned by %s (%s)", r->uri, r->method); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "Ignoring bogus HTTP header returned by %s (%s)", + r->uri, r->method); continue; } @@ -1440,8 +1434,8 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r, apr_status_t rc; rc = apr_socket_timeout_set(backend->sock, worker->s->ping_timeout); if (rc != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rc, r->server, - "proxy: could not set 100-Continue timeout"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rc, r, + "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) { 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); if (APR_STATUS_IS_TIMEUP(rc)) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: read timeout"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "read timeout"); if (do_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; 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." " Number of keepalives %i", backend->hostname, 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) { 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" - " failed.", backend->hostname, - backend->port); + " failed.", + backend->hostname, backend->port); } return ap_proxyerror(r, HTTP_BAD_GATEWAY, "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); if (r->headers_out == NULL) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, - r->server, "proxy: bad HTTP/%d.%d header " - "returned by %s (%s)", major, minor, r->uri, - r->method); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "bad HTTP/%d.%d header returned by %s (%s)", + major, minor, r->uri, r->method); backend->close += 1; /* * 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 */ apr_table_unset(r->headers_out, "Content-Length"); - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: server %s:%d returned Transfer-Encoding" - " and Content-Length", backend->hostname, - backend->port); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "server %s:%d returned Transfer-Encoding" + " and Content-Length", + backend->hostname, backend->port); 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, "proxy-interim-response"); ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, - "proxy: HTTP: received interim %d response", - r->status); + "HTTP: received interim %d response", r->status); if (!policy || !strcasecmp(policy, "RFC")) { 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")) { 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 @@ -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))) { apr_table_set(r->err_headers_out, wa, buf); } else { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: origin server sent 401 without WWW-Authenticate header"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "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"); - ap_log_error(APLOG_MARK, APLOG_TRACE3, 0, r->server, - "proxy: start body send"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE3, 0, r, "start body send"); /* * 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 * error bucket */ - ap_log_cerror(APLOG_MARK, APLOG_ERR, rv, c, - "proxy: error reading response"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, + "error reading response"); ap_proxy_backend_broke(r, bb); ap_pass_brigade(r->output_filters, bb); 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; #if DEBUGGING { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, - r->server, "proxy (PID %d): readbytes: %#x", - getpid(), readbytes); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "readbytes: %#x", readbytes); } #endif /* sanity check */ @@ -1972,12 +1962,10 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r, } while (!finish); } - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy: end body send"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "end body send"); } else if (!interim_response) { - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy: header only"); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, "header only"); /* make sure we release the backend connection as soon * 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? */ if (strcmp(scheme, "https") == 0) { if (!ap_proxy_ssl_enable(NULL)) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: HTTPS: declining URL %s" - " (mod_ssl not configured?)", url); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "HTTPS: declining URL %s (mod_ssl not configured?)", + url); return DECLINED; } is_ssl = 1; proxy_function = "HTTPS"; } else if (!(strcmp(scheme, "http") == 0 || (strcmp(scheme, "ftp") == 0 && proxyname))) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: HTTP: declining URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "HTTP: declining URL %s", + url); return DECLINED; /* only interested in HTTP, or FTP via proxy */ } else { @@ -2082,8 +2070,7 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker, else proxy_function = "FTP"; } - ap_log_error(APLOG_MARK, APLOG_TRACE1, 0, r->server, - "proxy: HTTP: serving URL %s", url); + ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "HTTP: serving URL %s", url); /* 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 */ if (ap_proxy_connect_backend(proxy_function, backend, worker, r->server)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: HTTP: failed to make connection to backend: %s", - backend->hostname); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "HTTP: failed to make connection to backend: %s", + backend->hostname); status = HTTP_SERVICE_UNAVAILABLE; break; } @@ -2154,9 +2141,9 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker, conf, uri, locurl, server_portstr)) != OK) { if ((status == HTTP_SERVICE_UNAVAILABLE) && worker->s->ping_timeout_set) { backend->close = 1; - ap_log_error(APLOG_MARK, APLOG_INFO, status, r->server, - "proxy: HTTP: 100-Continue failed to %pI (%s)", - worker->cp->addr, worker->s->hostname); + ap_log_rerror(APLOG_MARK, APLOG_INFO, status, r, + "HTTP: 100-Continue failed to %pI (%s)", + worker->cp->addr, worker->s->hostname); retry++; continue; } else { diff --git a/modules/proxy/mod_proxy_scgi.c b/modules/proxy/mod_proxy_scgi.c index bd9c53ed5c..3fe1b80bbd 100644 --- a/modules/proxy/mod_proxy_scgi.c +++ b/modules/proxy/mod_proxy_scgi.c @@ -40,7 +40,6 @@ #define SCHEME "scgi" -#define PROXY_FUNCTION "SCGI" #define SCGI_MAGIC "SCGI" #define SCGI_PROTOCOL_VERSION "1" #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; if ((rv = apr_socket_send(conn->sock, buf, &written)) != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, - "proxy: " PROXY_FUNCTION ": sending data to " - "%s:%u failed", conn->hostname, conn->port); + "sending data to %s:%u failed", + conn->hostname, conn->port); return HTTP_SERVICE_UNAVAILABLE; } @@ -337,8 +336,7 @@ static int send_request_body(request_rec *r, proxy_conn_rec *conn) } if (readlen == -1) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "proxy: " PROXY_FUNCTION ": receiving request body " - "failed"); + "receiving request body failed"); return HTTP_INTERNAL_SERVER_ERROR; } } @@ -373,8 +371,8 @@ static int pass_response(request_rec *r, proxy_conn_rec *conn) APLOG_MODULE_INDEX); if (status != OK) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "proxy: " PROXY_FUNCTION ": error reading response " - "headers from %s:%u", conn->hostname, conn->port); + "error reading response headers from %s:%u", + conn->hostname, conn->port); r->status_line = NULL; apr_brigade_destroy(bb); 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, sizeof(*req_conf)); ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: " PROXY_FUNCTION ": Found %s: %s - " - "preparing subrequest.", + "Found %s: %s - preparing subrequest.", conf->sendfile, location); if (err) { @@ -445,8 +442,7 @@ static int scgi_request_status(int *status, request_rec *r) switch (req_conf->type) { case scgi_internal_redirect: ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: " PROXY_FUNCTION ": Internal redirect to %s", - req_conf->location); + "Internal redirect to %s", req_conf->location); r->status_line = NULL; if (r->method_number != M_GET) { @@ -461,8 +457,7 @@ static int scgi_request_status(int *status, request_rec *r) case scgi_sendfile: ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: " PROXY_FUNCTION ": File subrequest to %s", - req_conf->location); + "File subrequest to %s", req_conf->location); do { request_rec *rr; @@ -511,12 +506,12 @@ static int scgi_handler(request_rec *r, proxy_worker *worker, if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) { ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, - "proxy: " PROXY_FUNCTION ": declining URL %s", url); + "declining URL %s", url); return DECLINED; } /* Create space for state information */ - status = ap_proxy_acquire_connection(PROXY_FUNCTION, &backend, worker, + status = ap_proxy_acquire_connection(__FUNCTION__, &backend, worker, r->server); if (status != OK) { goto cleanup; @@ -532,10 +527,10 @@ static int scgi_handler(request_rec *r, proxy_worker *worker, } /* Step Two: Make the Connection */ - if (ap_proxy_connect_backend(PROXY_FUNCTION, backend, worker, r->server)) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: " PROXY_FUNCTION ": failed to make connection " - "to backend: %s:%u", backend->hostname, backend->port); + if (ap_proxy_connect_backend(__FUNCTION__, backend, worker, r->server)) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "failed to make connection to backend: %s:%u", + backend->hostname, backend->port); status = HTTP_SERVICE_UNAVAILABLE; goto cleanup; } @@ -551,7 +546,7 @@ static int scgi_handler(request_rec *r, proxy_worker *worker, cleanup: if (backend) { 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; } diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index b0a9c19f7f..799fde21bd 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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->server = r->server; + rp->log = r->log; rp->proxyreq = r->proxyreq; rp->request_time = r->request_time; 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, "*")); r->status_line = apr_psprintf(r->pool, "%3.3u Proxy Error", statuscode); - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "proxy: %s returned by %s", message, r->uri); + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "%s returned by %s", message, + r->uri); 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 apr_sockaddr_t *conf_addr = npent[j].addr; uri_addr = src_uri_addr; - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy: checking remote machine [%s] against [%s]", uri_addr->hostname, npent[j].name); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, + "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)) || npent[j].name[0] == '*') { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy: connect to remote machine %s blocked: name %s matched", uri_addr->hostname, npent[j].name); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "connect to remote machine %s blocked: name %s " + "matched", uri_addr->hostname, npent[j].name); return HTTP_FORBIDDEN; } while (conf_addr) { @@ -911,11 +914,13 @@ PROXY_DECLARE(int) ap_proxy_checkproxyblock(request_rec *r, proxy_server_conf *c char *uri_ip; apr_sockaddr_ip_get(&conf_ip, conf_addr); apr_sockaddr_ip_get(&uri_ip, uri_addr); - ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, r->server, - "proxy: ProxyBlock comparing %s and %s", conf_ip, uri_ip); + ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, + "ProxyBlock comparing %s and %s", conf_ip, + uri_ip); if (!apr_strnatcasecmp(conf_ip, uri_ip)) { - ap_log_error(APLOG_MARK, APLOG_WARNING, 0, r->server, - "proxy: connect to remote machine %s blocked: IP %s matched", uri_addr->hostname, conf_ip); + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, + "connect to remote machine %s blocked: " + "IP %s matched", uri_addr->hostname, conf_ip); return HTTP_FORBIDDEN; } 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? */ if (conn->inreslist) { 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, worker->s->name); 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); 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_brigade_destroy(bb); @@ -1855,7 +1860,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser if (worker->tmutex == NULL) { rv = apr_thread_mutex_create(&(worker->tmutex), APR_THREAD_MUTEX_DEFAULT, p); 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"); return rv; } @@ -1863,8 +1868,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser if (worker->cp == NULL) init_conn_pool(p, worker); if (worker->cp == NULL) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "can not create connection pool"); + ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, + "can not create connection pool"); return APR_EGENERAL; } @@ -1880,7 +1885,7 @@ PROXY_DECLARE(apr_status_t) ap_proxy_initialize_worker(proxy_worker *worker, ser apr_pool_cleanup_null); 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, 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; 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); } } @@ -1917,13 +1922,13 @@ PROXY_DECLARE(int) ap_proxy_retry_worker(const char *proxy_function, ++worker->s->retries; worker->s->status &= ~PROXY_WORKER_IN_ERROR; 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); return OK; } else { 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); 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); if (*worker) { 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); *balancer = NULL; @@ -1954,8 +1959,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, else if (r->proxyreq == PROXYREQ_PROXY) { if (conf->forward) { ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, - "proxy: *: found forward proxy worker for %s", - *url); + "*: found forward proxy worker for %s", *url); *balancer = NULL; *worker = conf->forward; access_status = OK; @@ -1970,8 +1974,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, else if (r->proxyreq == PROXYREQ_REVERSE) { if (conf->reverse) { ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r, - "proxy: *: found reverse proxy worker for %s", - *url); + "*: found reverse proxy worker for %s", *url); *balancer = NULL; *worker = conf->reverse; access_status = OK; @@ -1987,8 +1990,7 @@ PROXY_DECLARE(int) ap_proxy_pre_request(proxy_worker **worker, else if (access_status == DECLINED && *balancer != NULL) { /* All the workers are busy */ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "proxy: all workers are busy. Unable to serve %s", - *url); + "all workers are busy. Unable to serve %s", *url); access_status = HTTP_SERVICE_UNAVAILABLE; } 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) { loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR; ap_log_rerror(APLOG_MARK, loglevel, rv, r, - "proxy: %s: error creating fam %d socket for target %s", - proxy_function, - backend_addr->family, - backend_name); + "%s: error creating fam %d socket for target %s", + proxy_function, backend_addr->family, backend_name); /* * this could be an IPv6 address from the DNS but 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, - "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); if (conf->source_address) { rv = apr_socket_bind(*newsock, conf->source_address); if (rv != APR_SUCCESS) { 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); } } @@ -2085,10 +2085,8 @@ PROXY_DECLARE(int) ap_proxy_connect_to_backend(apr_socket_t **newsock, apr_socket_close(*newsock); loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR; ap_log_rerror(APLOG_MARK, loglevel, rv, r, - "proxy: %s: attempt to connect to %pI (%s) failed", - proxy_function, - backend_addr, - backend_name); + "%s: attempt to connect to %pI (%s) failed", + proxy_function, backend_addr, backend_name); backend_addr = backend_addr->next; continue; } @@ -2110,7 +2108,7 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function, if (!PROXY_WORKER_IS_USABLE(worker)) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, - "proxy: %s: disabled connection for (%s)", + "%s: disabled connection for (%s)", proxy_function, worker->s->hostname); return HTTP_SERVICE_UNAVAILABLE; } @@ -2133,12 +2131,12 @@ PROXY_DECLARE(int) ap_proxy_acquire_connection(const char *proxy_function, if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, s, - "proxy: %s: failed to acquire connection for (%s)", + "%s: failed to acquire connection for (%s)", proxy_function, worker->s->hostname); return HTTP_SERVICE_UNAVAILABLE; } 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); (*conn)->worker = worker; @@ -2153,7 +2151,7 @@ PROXY_DECLARE(int) ap_proxy_release_connection(const char *proxy_function, server_rec *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); 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); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: connecting %s to %s:%d", *url, uri->hostname, - uri->port); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "connecting %s to %s:%d", *url, uri->hostname, uri->port); /* * 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) { if ((err = PROXY_THREAD_LOCK(worker)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, err, r->server, - "proxy: lock"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, err, r, "lock"); return HTTP_INTERNAL_SERVER_ERROR; } @@ -2281,8 +2277,7 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, worker->cp->pool); conn->addr = worker->cp->addr; if ((uerr = PROXY_THREAD_UNLOCK(worker)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, uerr, r->server, - "proxy: unlock"); + ap_log_rerror(APLOG_MARK, APLOG_ERR, uerr, r, "unlock"); } } else { @@ -2316,9 +2311,8 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r, return ap_proxyerror(r, HTTP_FORBIDDEN, "Connect to remote machine blocked"); } - ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server, - "proxy: connected %s to %s:%d", *url, conn->hostname, - conn->port); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, + "connected %s to %s:%d", *url, conn->hostname, conn->port); return OK; } @@ -2411,7 +2405,7 @@ static apr_status_t send_http_connect(proxy_conn_rec *backend, int len = 0; 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)", forward->target_host, forward->target_port, 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))) { socket_cleanup(conn); ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, - "proxy: %s: backend socket is disconnected.", + "%s: backend socket is disconnected.", proxy_function); } } @@ -2518,7 +2512,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, conn->scpool)) != APR_SUCCESS) { loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR; 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, backend_addr->family, 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, - "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); 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); if (rv != APR_SUCCESS) { 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); } } @@ -2593,7 +2587,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, apr_socket_close(newsock); loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR; 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, backend_addr, worker->s->hostname); @@ -2628,7 +2622,7 @@ PROXY_DECLARE(int) ap_proxy_connect_backend(const char *proxy_function, apr_socket_close(newsock); loglevel = backend_addr->next ? APLOG_DEBUG : APLOG_ERR; 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", proxy_function, forward->target_host, forward->target_port, @@ -2698,7 +2692,7 @@ PROXY_DECLARE(int) ap_proxy_connection_create(const char *proxy_function, * closed the socket */ 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, backend_addr, conn->hostname); /* 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 (!ap_proxy_ssl_enable(conn->connection)) { 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, backend_addr, conn->hostname); 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, - "proxy: %s: connection complete to %pI (%s)", + "%s: connection complete to %pI (%s)", 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) { conn->connection->aborted = 1; 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); return rc; } @@ -2819,7 +2813,7 @@ ap_proxy_buckets_lifetime_transform(request_rec *r, apr_bucket_brigade *from, } else { 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); apr_bucket_delete(e); rv = APR_EGENERAL; -- 2.40.0