From: André Malo Date: Mon, 5 Apr 2004 17:34:48 +0000 (+0000) Subject: allow RequestHeader to be conditional X-Git-Tag: pre_ajp_proxy~417 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=003d4555027d48d9875033cbf4fa8a6800be370b;p=apache allow RequestHeader to be conditional PR: 27951 Basically submitted by: vincent gryzor.com (Vincent Deffontaines) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@103269 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index fa5a3e6684..217dcf4978 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Allow RequestHeader directives to be conditional. PR 27951. + [Vincent Deffontaines , André Malo] + *) Fix segfault in mod_expires, which occured under certain circumstances. PR 28047. [André Malo] diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index fbcb504169..1fe056b513 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -424,10 +424,6 @@ static const char *header_inout_cmd(hdr_inout inout, cmd_parms *cmd, /* Handle the envclause on Header */ if (envclause != NULL) { - if (inout == hdr_in) { - return "error: envclause (env=...) only valid on " - "Header and ErrorHeader directives"; - } if (strncasecmp(envclause, "env=", 4) != 0) { return "error: envclause should be in the form env=envar"; } @@ -448,7 +444,7 @@ static const char *header_inout_cmd(hdr_inout inout, cmd_parms *cmd, return parse_format_string(cmd->pool, new, value); } -/* Handle Header directive */ +/* Handle all (xxx)Header directives */ static const char *header_cmd(cmd_parms *cmd, void *indirconf, const char *args) { @@ -464,19 +460,11 @@ static const char *header_cmd(cmd_parms *cmd, void *indirconf, hdr = ap_getword_conf(cmd->pool, &s); val = *s ? ap_getword_conf(cmd->pool, &s) : NULL; envclause = *s ? ap_getword_conf(cmd->pool, &s) : NULL; - outbl = (cmd->info == NULL) ? hdr_out : hdr_err; + outbl = (hdr_inout)cmd->info; return header_inout_cmd(outbl, cmd, indirconf, action, hdr, val, envclause); } -/* handle RequestHeader directive */ -static const char *request_header_cmd(cmd_parms *cmd, void *indirconf, - const char *action, const char *inhdr, - const char *value) -{ - return header_inout_cmd(hdr_in, cmd, indirconf, action, inhdr, value, NULL); -} - /* * Process the tags in the format string. Tags may be format specifiers * (%D, %t, etc.), whitespace or text strings. For each tag, run the handler @@ -680,13 +668,15 @@ static apr_status_t ap_headers_fixup(request_rec *r) static const command_rec headers_cmds[] = { - AP_INIT_RAW_ARGS("Header", header_cmd, NULL, OR_FILEINFO, - "an action, header and value followed by optional env clause"), - AP_INIT_RAW_ARGS("ErrorHeader", header_cmd, "", OR_FILEINFO, - "an action, header and value " - "followed by optional env clause"), - AP_INIT_TAKE23("RequestHeader", request_header_cmd, NULL, OR_FILEINFO, - "an action, header and value"), + AP_INIT_RAW_ARGS("Header", header_cmd, (void *)hdr_out, OR_FILEINFO, + "an action, header and value followed by optional env " + "clause"), + AP_INIT_RAW_ARGS("RequestHeader", header_cmd, (void *)hdr_in, OR_FILEINFO, + "an action, header and value followed by optional env " + "clause"), + AP_INIT_RAW_ARGS("ErrorHeader", header_cmd, (void *)hdr_err, OR_FILEINFO, + "an action, header and value followed by optional env " + "clause"), {NULL} };