You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sf...@apache.org on 2011/11/18 22:44:44 UTC
svn commit: r1203861 [2/2] - in /httpd/httpd/branches/2.4.x: ./
modules/proxy/
Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_http.c?rev=1203861&r1=1203860&r2=1203861&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_http.c Fri Nov 18 21:44:43 2011
@@ -53,8 +53,8 @@ static int proxy_http_canon(request_rec
}
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
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
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
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
*/
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
}
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 *
* 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 *
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 *
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 *
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,
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,
* 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,
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,
*/
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(reques
* 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_respo
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_respo
}
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_respo
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_respo
}
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_respo
&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_respo
* 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_respo
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_respo
*/
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_respo
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_respo
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_respo
* 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_respo
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_respo
} 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_re
/* 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_re
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_re
/* 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_re
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 {
Modified: httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_scgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_scgi.c?rev=1203861&r1=1203860&r2=1203861&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_scgi.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/mod_proxy_scgi.c Fri Nov 18 21:44:43 2011
@@ -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,
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
}
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,
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,
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 *stat
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 *stat
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,
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,
}
/* 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,
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;
}
Modified: httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c?rev=1203861&r1=1203860&r2=1203861&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c (original)
+++ httpd/httpd/branches/2.4.x/modules/proxy/proxy_util.c Fri Nov 18 21:44:43 2011
@@ -385,6 +385,7 @@ PROXY_DECLARE(request_rec *)ap_proxy_mak
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
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_checkproxybl
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_checkproxybl
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(v
/* 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
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_ini
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_ini
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_ini
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_ini
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
++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(
*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(
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(
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(
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_b
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_b
}
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_b
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_conn
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_conn
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_conn
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
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
}
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
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
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(pr
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_back
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_back
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_back
}
}
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_back
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_back
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_back
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_c
* 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_c
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_c
}
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_c
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(requ
}
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;