mirror of
https://github.com/apache/httpd.git
synced 2025-08-07 04:02:58 +03:00
Revert style changes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1630971 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -109,7 +109,6 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
|
||||
if (APR_BUCKET_IS_METADATA(e)) {
|
||||
/* metadata bucket */
|
||||
apr_bucket *cpy;
|
||||
|
||||
apr_bucket_copy(e, &cpy);
|
||||
APR_BRIGADE_INSERT_TAIL(ctx->bb, cpy);
|
||||
continue;
|
||||
@@ -125,7 +124,6 @@ static apr_status_t bucketeer_out_filter(ap_filter_t *f,
|
||||
data[i] == c->bucketdelimiter ||
|
||||
data[i] == c->passdelimiter) {
|
||||
apr_bucket *p;
|
||||
|
||||
if (i - lastpos > 0) {
|
||||
p = apr_bucket_pool_create(apr_pmemdup(f->r->pool,
|
||||
&data[lastpos],
|
||||
|
@@ -26,6 +26,7 @@
|
||||
* It can produce a *huge* amount of data.
|
||||
*/
|
||||
|
||||
|
||||
#include "httpd.h"
|
||||
#include "http_connection.h"
|
||||
#include "http_config.h"
|
||||
@@ -61,7 +62,8 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
||||
b->type->name,
|
||||
b->length) ;
|
||||
|
||||
if (!(APR_BUCKET_IS_METADATA(b))) {
|
||||
if (!(APR_BUCKET_IS_METADATA(b)))
|
||||
{
|
||||
#if APR_CHARSET_EBCDIC
|
||||
char xlatebuf[dumpio_MAX_STRING_LEN + 1];
|
||||
#endif
|
||||
@@ -69,10 +71,11 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
||||
apr_size_t nbytes;
|
||||
apr_status_t rv = apr_bucket_read(b, &buf, &nbytes, APR_BLOCK_READ);
|
||||
|
||||
if (rv == APR_SUCCESS) {
|
||||
while (nbytes) {
|
||||
if (rv == APR_SUCCESS)
|
||||
{
|
||||
while (nbytes)
|
||||
{
|
||||
apr_size_t logbytes = nbytes;
|
||||
|
||||
if (logbytes > dumpio_MAX_STRING_LEN)
|
||||
logbytes = dumpio_MAX_STRING_LEN;
|
||||
nbytes -= logbytes;
|
||||
@@ -121,9 +124,9 @@ static void dumpit(ap_filter_t *f, apr_bucket *b, dumpio_conf_t *ptr)
|
||||
)
|
||||
|
||||
static int dumpio_input_filter (ap_filter_t *f, apr_bucket_brigade *bb,
|
||||
ap_input_mode_t mode, apr_read_type_e block,
|
||||
apr_off_t readbytes)
|
||||
ap_input_mode_t mode, apr_read_type_e block, apr_off_t readbytes)
|
||||
{
|
||||
|
||||
apr_bucket *b;
|
||||
apr_status_t ret;
|
||||
conn_rec *c = f->c;
|
||||
@@ -139,9 +142,7 @@ static int dumpio_input_filter(ap_filter_t *f, apr_bucket_brigade *bb,
|
||||
ret = ap_get_brigade(f->next, bb, mode, block, readbytes);
|
||||
|
||||
if (ret == APR_SUCCESS) {
|
||||
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)) {
|
||||
dumpit(f, b, ptr);
|
||||
}
|
||||
}
|
||||
@@ -160,12 +161,9 @@ static int dumpio_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
|
||||
conn_rec *c = f->c;
|
||||
dumpio_conf_t *ptr = f->ctx;
|
||||
|
||||
ap_log_cerror(APLOG_MARK, APLOG_TRACE7, 0, c, "mod_dumpio: %s",
|
||||
f->frec->name);
|
||||
ap_log_cerror(APLOG_MARK, APLOG_TRACE7, 0, c, "mod_dumpio: %s", f->frec->name);
|
||||
|
||||
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)) {
|
||||
/*
|
||||
* If we ever see an EOS, make sure to FLUSH.
|
||||
*/
|
||||
@@ -210,7 +208,6 @@ static void dumpio_register_hooks(apr_pool_t *p)
|
||||
static void *dumpio_create_sconfig(apr_pool_t *p, server_rec *s)
|
||||
{
|
||||
dumpio_conf_t *ptr = apr_pcalloc(p, sizeof *ptr);
|
||||
|
||||
ptr->enable_input = 0;
|
||||
ptr->enable_output = 0;
|
||||
return ptr;
|
||||
|
@@ -107,7 +107,6 @@ 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;
|
||||
}
|
||||
@@ -115,7 +114,6 @@ 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;
|
||||
}
|
||||
@@ -135,8 +133,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);
|
||||
@@ -145,24 +143,22 @@ 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;
|
||||
}
|
||||
@@ -212,8 +208,7 @@ 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);
|
||||
|
||||
@@ -230,32 +225,22 @@ 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;
|
||||
@@ -303,9 +288,8 @@ 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;
|
||||
@@ -440,8 +424,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;
|
||||
}
|
||||
@@ -491,16 +475,17 @@ 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");
|
||||
@@ -553,17 +538,15 @@ 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);
|
||||
|
||||
@@ -579,8 +562,7 @@ static const char *firehose_enable_connection(cmd_parms *cmd,
|
||||
#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")) {
|
||||
@@ -588,8 +570,7 @@ static const char *firehose_enable_connection(cmd_parms *cmd,
|
||||
}
|
||||
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 {
|
||||
@@ -600,85 +581,93 @@ static const char *firehose_enable_connection(cmd_parms *cmd,
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return firehose_enable_connection(cmd, arg1, arg2, FIREHOSE_NORMAL,
|
||||
FIREHOSE_IN, FIREHOSE_CONNECTION);
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return firehose_enable_connection(cmd, arg1, arg2, FIREHOSE_NORMAL,
|
||||
FIREHOSE_OUT, FIREHOSE_CONNECTION);
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return firehose_enable_connection(cmd, arg1, arg2, FIREHOSE_NORMAL,
|
||||
FIREHOSE_IN, FIREHOSE_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return firehose_enable_connection(cmd, arg1, arg2, FIREHOSE_NORMAL,
|
||||
FIREHOSE_OUT, FIREHOSE_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return firehose_enable_connection(cmd, arg1, arg2, FIREHOSE_PROXY,
|
||||
FIREHOSE_IN, FIREHOSE_CONNECTION);
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return firehose_enable_connection(cmd, arg1, arg2, FIREHOSE_PROXY,
|
||||
FIREHOSE_OUT, FIREHOSE_CONNECTION);
|
||||
|
||||
}
|
||||
|
||||
static const command_rec firehose_cmds[] =
|
||||
|
Reference in New Issue
Block a user