diff options
-rw-r--r-- | include/ap_mmn.h | 5 | ||||
-rw-r--r-- | include/http_core.h | 8 | ||||
-rw-r--r-- | server/core.c | 33 |
3 files changed, 43 insertions, 3 deletions
diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 4724ab3817..268ba353b3 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -97,14 +97,15 @@ * 20050305.2 (2.1.5-dev) added AP_INIT_TAKE_ARGV. * 20050305.3 (2.1.5-dev) added Protocol Framework. * 20050701.0 (2.1.7-dev) Bump MODULE_MAGIC_COOKIE to "AP21"! - */ + * 20050701.1 (2.1.7-dev) trace_enable member added to core server_config + */ #define MODULE_MAGIC_COOKIE 0x41503231UL /* "AP21" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20050701 #endif -#define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 1 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/include/http_core.h b/include/http_core.h index e22b7bb909..d25f93c976 100644 --- a/include/http_core.h +++ b/include/http_core.h @@ -551,6 +551,14 @@ typedef struct { const char *protocol; apr_table_t *accf_map; + + /* TRACE control */ +#define AP_TRACE_UNSET -1 +#define AP_TRACE_DISABLE 0 +#define AP_TRACE_ENABLE 1 +#define AP_TRACE_EXTENDED 2 + int trace_enable; + } core_server_config; /* for AddOutputFiltersByType in core.c */ diff --git a/server/core.c b/server/core.c index 2bf34fbe28..150f361e95 100644 --- a/server/core.c +++ b/server/core.c @@ -482,6 +482,8 @@ static void *create_core_server_config(apr_pool_t *a, server_rec *s) apr_table_set(conf->accf_map, "https", "dataready"); #endif + conf->trace_enable = AP_TRACE_UNSET; + return (void *)conf; } @@ -516,6 +518,11 @@ static void *merge_core_server_configs(apr_pool_t *p, void *basev, void *virtv) conf->subreq_limit = virt->subreq_limit ? virt->subreq_limit : base->subreq_limit; + + conf->trace_enable = (virt->trace_enable != AP_TRACE_UNSET) + ? virt->trace_enable + : base->trace_enable; + return conf; } @@ -1724,7 +1731,7 @@ AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, methnum = ap_method_number_of(method); if (methnum == M_TRACE && !tog) { - return "TRACE cannot be controlled by <Limit>"; + return "TRACE cannot be controlled by <Limit>, see TraceEnable"; } else if (methnum == M_INVALID) { /* method has not been registered yet, but resorce restriction @@ -3119,6 +3126,28 @@ void ap_add_output_filters_by_type(request_rec *r) return; } +static const char *set_trace_enable(cmd_parms *cmd, void *dummy, + const char *arg1) +{ + core_server_config *conf = ap_get_module_config(cmd->server->module_config, + &core_module); + + if (strcasecmp(arg1, "on") == 0) { + conf->trace_enable = AP_TRACE_ENABLE; + } + else if (strcasecmp(arg1, "off") == 0) { + conf->trace_enable = AP_TRACE_DISABLE; + } + else if (strcasecmp(arg1, "extended") == 0) { + conf->trace_enable = AP_TRACE_EXTENDED; + } + else { + return "TraceEnable must be one of 'on', 'off', or 'extended'"; + } + + return NULL; +} + /* Note --- ErrorDocument will now work from .htaccess files. * The AllowOverride of Fileinfo allows webmasters to turn it off */ @@ -3346,6 +3375,8 @@ AP_INIT_TAKE1("ThreadStackSize", ap_mpm_set_thread_stacksize, NULL, RSRC_CONF, AP_INIT_TAKE1("EnableExceptionHook", ap_mpm_set_exception_hook, NULL, RSRC_CONF, "Controls whether exception hook may be called after a crash"), #endif +AP_INIT_TAKE1("TraceEnable", set_trace_enable, NULL, RSRC_CONF, + "'on' (default), 'off' or 'extended' to trace request body content"), { NULL } }; |