Commit ee854961 authored by William A. Rowe Jr's avatar William A. Rowe Jr
Browse files

  Initially a no-op.  Add trace_enable configuration.  The http and proxy
  flavors of interpreting this flag are yet to be committed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@208785 13f79535-47bb-0310-9956-ffa450edef68
parent 1efd13b2
Loading
Loading
Loading
Loading
+2 −1
Changes for include/ap_mmn.h: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@
 * 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" */
@@ -104,7 +105,7 @@
#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
+8 −0
Changes for include/http_core.h: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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 */
+32 −1
Changes for server/core.c: 32 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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 }
};