View | Details | Raw Unified | Return to bug 15242
Collapse All | Expand All

(-)apache-1.3/src/modules/standard/mod_cgi.c.orig (-3 / +33 lines)
Lines 98-109 Link Here
98
#define DEFAULT_LOGBYTES 10385760
98
#define DEFAULT_LOGBYTES 10385760
99
#define DEFAULT_BUFBYTES 1024
99
#define DEFAULT_BUFBYTES 1024
100
100
101
enum { FLAG_UNSET, FLAG_ON, FLAG_OFF };
102
101
typedef struct {
103
typedef struct {
102
    char *logname;
104
    char *logname;
103
    long logbytes;
105
    long logbytes;
104
    int bufbytes;
106
    int bufbytes;
105
} cgi_server_conf;
107
} cgi_server_conf;
106
108
109
typedef struct {
110
    int trapoptions;
111
} cgi_dir_conf;
112
113
static void *create_cgi_dconfig(pool *p, char *d)
114
{
115
    cgi_dir_conf *c = (cgi_dir_conf *) ap_pcalloc(p, sizeof(cgi_dir_conf));
116
117
    c->trapoptions = FLAG_UNSET;
118
119
    return c;
120
}
121
122
static void *merge_cgi_dconfig(pool *p, void *basev, void *overridesv)
123
{
124
    cgi_dir_conf *base = (cgi_dir_conf *) basev, *overrides = (cgi_dir_conf *) overridesv;
125
126
    if (overrides->trapoptions == FLAG_UNSET) {
127
        overrides->trapoptions = base->trapoptions;
128
    }
129
    return overrides;
130
}
131
107
static void *create_cgi_config(pool *p, server_rec *s)
132
static void *create_cgi_config(pool *p, server_rec *s)
108
{
133
{
109
    cgi_server_conf *c =
134
    cgi_server_conf *c =
Lines 161-166 Link Here
161
     "the maximum length (in bytes) of the script debug log"},
186
     "the maximum length (in bytes) of the script debug log"},
162
    {"ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, TAKE1,
187
    {"ScriptLogBuffer", set_scriptlog_buffer, NULL, RSRC_CONF, TAKE1,
163
     "the maximum size (in bytes) to record of a POST request"},
188
     "the maximum size (in bytes) to record of a POST request"},
189
    {"ScriptTrapOptions", ap_set_flag_slot,
190
     (void *)XtOffsetOf(cgi_dir_conf, trapoptions), OR_ALL, FLAG,
191
     "the flag to specify whether CGI handles OPTIONS request or not"},
164
    {NULL}
192
    {NULL}
165
};
193
};
166
194
Lines 377-386 Link Here
377
    void *sconf = r->server->module_config;
405
    void *sconf = r->server->module_config;
378
    cgi_server_conf *conf =
406
    cgi_server_conf *conf =
379
    (cgi_server_conf *) ap_get_module_config(sconf, &cgi_module);
407
    (cgi_server_conf *) ap_get_module_config(sconf, &cgi_module);
408
    cgi_dir_conf *dconf =
409
    (cgi_dir_conf *) ap_get_module_config(r->per_dir_config, &cgi_module);
380
410
381
    struct cgi_child_stuff cld;
411
    struct cgi_child_stuff cld;
382
412
383
    if (r->method_number == M_OPTIONS) {
413
    if (dconf->trapoptions != FLAG_OFF && r->method_number == M_OPTIONS) {
384
	/* 99 out of 100 CGI scripts, this is all they support */
414
	/* 99 out of 100 CGI scripts, this is all they support */
385
	r->allowed |= (1 << M_GET);
415
	r->allowed |= (1 << M_GET);
386
	r->allowed |= (1 << M_POST);
416
	r->allowed |= (1 << M_POST);
Lines 610-617 Link Here
610
{
640
{
611
    STANDARD_MODULE_STUFF,
641
    STANDARD_MODULE_STUFF,
612
    NULL,			/* initializer */
642
    NULL,			/* initializer */
613
    NULL,			/* dir config creater */
643
    create_cgi_dconfig,		/* dir config creater */
614
    NULL,			/* dir merger --- default is to override */
644
    merge_cgi_dconfig,		/* dir merger --- default is to override */
615
    create_cgi_config,		/* server config */
645
    create_cgi_config,		/* server config */
616
    merge_cgi_config,		/* merge server config */
646
    merge_cgi_config,		/* merge server config */
617
    cgi_cmds,			/* command table */
647
    cgi_cmds,			/* command table */

Return to bug 15242