mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Style
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1629736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -107,6 +107,7 @@ typedef struct firehose_ctx_t
|
||||
static apr_status_t filter_output_cleanup(void *dummy)
|
||||
{
|
||||
ap_filter_t *f = (ap_filter_t *)dummy;
|
||||
|
||||
ap_remove_output_filter(f);
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
@@ -114,6 +115,7 @@ static apr_status_t filter_output_cleanup(void *dummy)
|
||||
static apr_status_t filter_input_cleanup(void *dummy)
|
||||
{
|
||||
ap_filter_t *f = (ap_filter_t *)dummy;
|
||||
|
||||
ap_remove_input_filter(f);
|
||||
return APR_SUCCESS;
|
||||
}
|
||||
@@ -133,8 +135,8 @@ static apr_status_t pumpit_cleanup(void *dummy)
|
||||
}
|
||||
|
||||
hdr_len = apr_snprintf(header, sizeof(header), HEADER_FMT,
|
||||
(apr_uint64_t) 0, (apr_uint64_t) apr_time_now(), ctx->direction,
|
||||
ctx->uuid, ctx->count);
|
||||
(apr_uint64_t)0, (apr_uint64_t)apr_time_now(),
|
||||
ctx->direction, ctx->uuid, ctx->count);
|
||||
ap_xlate_proto_to_ascii(header, hdr_len);
|
||||
|
||||
rv = apr_file_write_full(ctx->conn->file, header, hdr_len, NULL);
|
||||
@@ -143,22 +145,24 @@ static apr_status_t pumpit_cleanup(void *dummy)
|
||||
/* ignore the error */
|
||||
}
|
||||
else if (ctx->r) {
|
||||
ap_log_rerror(
|
||||
APLOG_MARK,
|
||||
APLOG_WARNING,
|
||||
rv,
|
||||
ctx->r,
|
||||
"mod_firehose: could not write %" APR_UINT64_T_FMT " bytes to '%s' for '%c' connection '%s' and count '%0" APR_UINT64_T_HEX_FMT "', bytes dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(hdr_len), ctx->conn->filename, ctx->conn->direction, ctx->uuid, ctx->count);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, ctx->r,
|
||||
"mod_firehose: could not write %"
|
||||
APR_UINT64_T_FMT
|
||||
" bytes to '%s' for '%c' connection '%s' and"
|
||||
" count '%0" APR_UINT64_T_HEX_FMT "', bytes"
|
||||
" dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(hdr_len), ctx->conn->filename,
|
||||
ctx->conn->direction, ctx->uuid, ctx->count);
|
||||
}
|
||||
else {
|
||||
ap_log_cerror(
|
||||
APLOG_MARK,
|
||||
APLOG_WARNING,
|
||||
rv,
|
||||
ctx->c,
|
||||
"mod_firehose: could not write %" APR_UINT64_T_FMT " bytes to '%s' for '%c' connection '%s' and count '%0" APR_UINT64_T_HEX_FMT "', bytes dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(hdr_len), ctx->conn->filename, ctx->conn->direction, ctx->uuid, ctx->count);
|
||||
ap_log_cerror(APLOG_MARK, APLOG_WARNING, rv, ctx->c,
|
||||
"mod_firehose: could not write %"
|
||||
APR_UINT64_T_FMT
|
||||
" bytes to '%s' for '%c' connection '%s' and"
|
||||
" count '%0" APR_UINT64_T_HEX_FMT "', bytes"
|
||||
" dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(hdr_len), ctx->conn->filename,
|
||||
ctx->conn->direction, ctx->uuid, ctx->count);
|
||||
}
|
||||
ctx->conn->suppress = 1;
|
||||
}
|
||||
@@ -208,7 +212,8 @@ static apr_status_t pumpit(ap_filter_t *f, apr_bucket *b, firehose_ctx_t *ctx)
|
||||
* the chunk.
|
||||
*/
|
||||
hdr_len = apr_snprintf(header, sizeof(header), HEADER_FMT,
|
||||
(apr_uint64_t) body_len, (apr_uint64_t) apr_time_now(),
|
||||
(apr_uint64_t)body_len,
|
||||
(apr_uint64_t)apr_time_now(),
|
||||
ctx->direction, ctx->uuid, ctx->count);
|
||||
ap_xlate_proto_to_ascii(header, hdr_len);
|
||||
|
||||
@@ -225,22 +230,32 @@ static apr_status_t pumpit(ap_filter_t *f, apr_bucket *b, firehose_ctx_t *ctx)
|
||||
/* ignore the error */
|
||||
}
|
||||
else if (ctx->r) {
|
||||
ap_log_rerror(
|
||||
APLOG_MARK,
|
||||
APLOG_WARNING,
|
||||
rv,
|
||||
ctx->r,
|
||||
"mod_firehose: could not write %" APR_UINT64_T_FMT " bytes to '%s' for '%c' connection '%s' and count '%0" APR_UINT64_T_HEX_FMT "', bytes dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(vec[0].iov_len + vec[1].iov_len + vec[2].iov_len), ctx->conn->filename, ctx->conn->direction, ctx->uuid, ctx->count);
|
||||
ap_log_rerror(APLOG_MARK, APLOG_WARNING, rv, ctx->r,
|
||||
"mod_firehose: could not write %"
|
||||
APR_UINT64_T_FMT
|
||||
" bytes to '%s' for '%c' connection '%s' and"
|
||||
" count '%0" APR_UINT64_T_HEX_FMT "', bytes"
|
||||
" dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(vec[0].iov_len +
|
||||
vec[1].iov_len +
|
||||
vec[2].iov_len),
|
||||
ctx->conn->filename,
|
||||
ctx->conn->direction, ctx->uuid,
|
||||
ctx->count);
|
||||
}
|
||||
else {
|
||||
ap_log_cerror(
|
||||
APLOG_MARK,
|
||||
APLOG_WARNING,
|
||||
rv,
|
||||
ctx->c,
|
||||
"mod_firehose: could not write %" APR_UINT64_T_FMT " bytes to '%s' for '%c' connection '%s' and count '%0" APR_UINT64_T_HEX_FMT "', bytes dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(vec[0].iov_len + vec[1].iov_len + vec[2].iov_len), ctx->conn->filename, ctx->conn->direction, ctx->uuid, ctx->count);
|
||||
ap_log_cerror(APLOG_MARK, APLOG_WARNING, rv, ctx->c,
|
||||
"mod_firehose: could not write %"
|
||||
APR_UINT64_T_FMT
|
||||
" bytes to '%s' for '%c' connection '%s' and"
|
||||
" count '%0" APR_UINT64_T_HEX_FMT "', bytes"
|
||||
" dropped (further errors will be suppressed)",
|
||||
(apr_uint64_t)(vec[0].iov_len +
|
||||
vec[1].iov_len +
|
||||
vec[2].iov_len),
|
||||
ctx->conn->filename,
|
||||
ctx->conn->direction, ctx->uuid,
|
||||
ctx->count);
|
||||
}
|
||||
ctx->conn->suppress = 1;
|
||||
rv = APR_SUCCESS;
|
||||
@@ -288,8 +303,9 @@ static apr_status_t firehose_input_filter(ap_filter_t *f,
|
||||
return rv;
|
||||
}
|
||||
|
||||
for (b = APR_BRIGADE_FIRST(bb); b != APR_BRIGADE_SENTINEL(bb); b
|
||||
= APR_BUCKET_NEXT(b)) {
|
||||
for (b = APR_BRIGADE_FIRST(bb);
|
||||
b != APR_BRIGADE_SENTINEL(bb);
|
||||
b = APR_BUCKET_NEXT(b)) {
|
||||
rv = pumpit(f, b, ctx);
|
||||
if (APR_SUCCESS != rv) {
|
||||
return rv;
|
||||
@@ -424,8 +440,8 @@ static int firehose_pre_conn(conn_rec *c, void *csd)
|
||||
conn = (firehose_conn_t *)conf->firehoses->elts;
|
||||
for (i = 0; i < conf->firehoses->nelts; i++) {
|
||||
|
||||
if (!conn->file || (conn->proxy == FIREHOSE_NORMAL
|
||||
&& !c->sbh) || (conn->proxy == FIREHOSE_PROXY && c->sbh)) {
|
||||
if (!conn->file || (conn->proxy == FIREHOSE_NORMAL && !c->sbh) ||
|
||||
(conn->proxy == FIREHOSE_PROXY && c->sbh)) {
|
||||
conn++;
|
||||
continue;
|
||||
}
|
||||
@@ -475,17 +491,16 @@ static int firehose_open_logs(apr_pool_t *p, apr_pool_t *plog,
|
||||
|
||||
while (s) {
|
||||
|
||||
conf = ap_get_module_config(s->module_config,
|
||||
&firehose_module);
|
||||
conf = ap_get_module_config(s->module_config, &firehose_module);
|
||||
|
||||
conn = (firehose_conn_t *)conf->firehoses->elts;
|
||||
for (i = 0; i < conf->firehoses->nelts; i++) {
|
||||
if (APR_SUCCESS != (rv = apr_file_open(&conn->file, conn->filename,
|
||||
APR_FOPEN_WRITE | APR_FOPEN_CREATE | APR_FOPEN_APPEND
|
||||
| conn->nonblock, APR_OS_DEFAULT, plog))) {
|
||||
ap_log_error(APLOG_MARK,
|
||||
APLOG_WARNING,
|
||||
rv, s, "mod_firehose: could not open '%s' for write, disabling firehose %s%s %s filter",
|
||||
ap_log_error(APLOG_MARK, APLOG_WARNING, rv, s,
|
||||
"mod_firehose: could not open '%s' for write, "
|
||||
"disabling firehose %s%s %s filter",
|
||||
conn->filename, conn->proxy == FIREHOSE_PROXY ? "proxy " : "",
|
||||
conn->request == FIREHOSE_REQUEST ? " request" : "connection",
|
||||
conn->direction == FIREHOSE_IN ? "input" : "output");
|
||||
@@ -538,15 +553,17 @@ static void *firehose_merge_sconfig(apr_pool_t *p, void *basev,
|
||||
return cconf;
|
||||
}
|
||||
|
||||
static const char *firehose_enable_connection(cmd_parms *cmd, const char *arg1,
|
||||
const char *arg2, proxy_enum proxy, direction_enum direction,
|
||||
static const char *firehose_enable_connection(cmd_parms *cmd,
|
||||
const char *arg1,
|
||||
const char *arg2,
|
||||
proxy_enum proxy,
|
||||
direction_enum direction,
|
||||
request_enum request)
|
||||
{
|
||||
const char *name = arg2 ? arg2 : arg1;
|
||||
|
||||
firehose_conn_t *firehose;
|
||||
firehose_conf_t
|
||||
*ptr =
|
||||
firehose_conf_t *ptr =
|
||||
(firehose_conf_t *)ap_get_module_config(cmd->server->module_config,
|
||||
&firehose_module);
|
||||
|
||||
@@ -562,7 +579,8 @@ static const char *firehose_enable_connection(cmd_parms *cmd, const char *arg1,
|
||||
#ifdef APR_FOPEN_NONBLOCK
|
||||
firehose->nonblock = APR_FOPEN_NONBLOCK;
|
||||
#else
|
||||
return "The parameter 'nonblock' is not supported by APR on this platform";
|
||||
return "The parameter 'nonblock' is not supported by APR on this "
|
||||
"platform";
|
||||
#endif
|
||||
}
|
||||
else if (!strcmp(arg1, "block")) {
|
||||
@@ -570,7 +588,8 @@ static const char *firehose_enable_connection(cmd_parms *cmd, const char *arg1,
|
||||
}
|
||||
else {
|
||||
return apr_psprintf(cmd->pool,
|
||||
"The parameter '%s' should be 'block' or 'nonblock'", arg1);
|
||||
"The parameter '%s' should be 'block' or 'nonblock'",
|
||||
arg1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -581,11 +600,12 @@ static const char *firehose_enable_connection(cmd_parms *cmd, const char *arg1,
|
||||
}
|
||||
|
||||
static const char *firehose_enable_connection_input(cmd_parms *cmd,
|
||||
void *dummy, const char *arg1, const char *arg2)
|
||||
void *dummy,
|
||||
const char *arg1,
|
||||
const char *arg2)
|
||||
{
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY
|
||||
| NOT_IN_LIMIT);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY | NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
@@ -596,11 +616,12 @@ static const char *firehose_enable_connection_input(cmd_parms *cmd,
|
||||
}
|
||||
|
||||
static const char *firehose_enable_connection_output(cmd_parms *cmd,
|
||||
void *dummy, const char *arg1, const char *arg2)
|
||||
void *dummy,
|
||||
const char *arg1,
|
||||
const char *arg2)
|
||||
{
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY
|
||||
| NOT_IN_LIMIT);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY | NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
@@ -611,11 +632,11 @@ static const char *firehose_enable_connection_output(cmd_parms *cmd,
|
||||
}
|
||||
|
||||
static const char *firehose_enable_request_input(cmd_parms *cmd, void *dummy,
|
||||
const char *arg1, const char *arg2)
|
||||
const char *arg1,
|
||||
const char *arg2)
|
||||
{
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY
|
||||
| NOT_IN_LIMIT);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY | NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
@@ -626,11 +647,11 @@ static const char *firehose_enable_request_input(cmd_parms *cmd, void *dummy,
|
||||
}
|
||||
|
||||
static const char *firehose_enable_request_output(cmd_parms *cmd, void *dummy,
|
||||
const char *arg1, const char *arg2)
|
||||
const char *arg1,
|
||||
const char *arg2)
|
||||
{
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY
|
||||
| NOT_IN_LIMIT);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY | NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
@@ -641,11 +662,12 @@ static const char *firehose_enable_request_output(cmd_parms *cmd, void *dummy,
|
||||
}
|
||||
|
||||
static const char *firehose_enable_proxy_connection_input(cmd_parms *cmd,
|
||||
void *dummy, const char *arg1, const char *arg2)
|
||||
void *dummy,
|
||||
const char *arg1,
|
||||
const char *arg2)
|
||||
{
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY
|
||||
| NOT_IN_LIMIT);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY | NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
@@ -656,11 +678,12 @@ static const char *firehose_enable_proxy_connection_input(cmd_parms *cmd,
|
||||
}
|
||||
|
||||
static const char *firehose_enable_proxy_connection_output(cmd_parms *cmd,
|
||||
void *dummy, const char *arg1, const char *arg2)
|
||||
void *dummy,
|
||||
const char *arg1,
|
||||
const char *arg2)
|
||||
{
|
||||
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY
|
||||
| NOT_IN_LIMIT);
|
||||
const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY | NOT_IN_LIMIT);
|
||||
if (err != NULL) {
|
||||
return err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user