From: Eric Covener Date: Wed, 29 Dec 2010 03:08:44 +0000 (+0000) Subject: revert r1031670: X-Git-Tag: 2.3.11~321 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a76afb8b3d30d18fb84b40301b5bcf59659ffc0;p=apache revert r1031670: Change the default of the Header directive to apply to responses of all types instead of just 2xx successful responses. This turned out to be do more harm than good for anything other than "set", since "always" doesn't ever see/operate on existing r->headers_out headers -- just err_headers_out. I think onsuccess needs to remain the default and this needs to move into a doc revamp. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1053516 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index b90e0173a1..44dba865b3 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.11 + *) mod_headers: Restore the 2.3.8 and earlier default for the first + argument of the Header directive ("onsuccess"). [Eric Covener] + *) core: Disallow the mixing of relative and absolute Options PR 33708. [Sönke Tesch ] diff --git a/docs/manual/mod/mod_headers.xml b/docs/manual/mod/mod_headers.xml index 8371fc2293..e559a3c0d7 100644 --- a/docs/manual/mod/mod_headers.xml +++ b/docs/manual/mod/mod_headers.xml @@ -300,7 +300,6 @@ headers server configvirtual host directory.htaccess FileInfo -Default condition changes in 2.3.9 from "onsuccess" to "always"

This directive can replace, merge or remove HTTP response @@ -308,16 +307,18 @@ headers and output filters are run, allowing outgoing headers to be modified.

-

In 2.3.9 and later, the default condition is "always", meaning this directive - acts without regard for the response status code. In 2.3.8 and earlier, - "onsuccess" is the default, meaning headers are only modified for 2xx - responses.

- -

An effective value of always may be needed to influence - headers set by some internal modules (such as mod_cgi) - even for successful responses, and is always needed to affect - non-2xx responses such as redirects or client - errors.

+

By default, this directive only affects successful responses (responses + in the 2xx range). The optional condition + can be either onsuccess (default) or always (all + status codes, including successful responses). A value of always + may be needed to influence headers set by some internal modules even for + successful responses, and is always needed to affect non-2xx + responses such as redirects or client errors.

+ + CGI +

To manipulate headers set by CGI scripts, it is necessary to specify + always for the first parameter.

+

The action it performs is determined by the first argument (second argument if a condition is specified). diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index b1948e0204..40fe34e768 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -104,7 +104,7 @@ typedef enum { */ static char hdr_in = '0'; /* RequestHeader */ static char hdr_out_onsuccess = '1'; /* Header onsuccess */ -static char hdr_out_always = '2'; /* Header always (default) */ +static char hdr_out_always = '2'; /* Header always */ /* Callback function type. */ typedef const char *format_tag_fn(request_rec *r, char *a); @@ -524,12 +524,12 @@ static const char *header_cmd(cmd_parms *cmd, void *indirconf, const char *subs; action = ap_getword_conf(cmd->temp_pool, &args); - if (cmd->info == &hdr_out_always) { - if (!strcasecmp(action, "onsuccess")) { - cmd->info = &hdr_out_onsuccess; + if (cmd->info == &hdr_out_onsuccess) { + if (!strcasecmp(action, "always")) { + cmd->info = &hdr_out_always; action = ap_getword_conf(cmd->temp_pool, &args); } - else if (!strcasecmp(action, "always")) { + else if (!strcasecmp(action, "onsuccess")) { action = ap_getword_conf(cmd->temp_pool, &args); } } @@ -863,7 +863,7 @@ static apr_status_t ap_headers_early(request_rec *r) static const command_rec headers_cmds[] = { - AP_INIT_RAW_ARGS("Header", header_cmd, &hdr_out_always, OR_FILEINFO, + AP_INIT_RAW_ARGS("Header", header_cmd, &hdr_out_onsuccess, OR_FILEINFO, "an optional condition, an action, header and value " "followed by optional env clause"), AP_INIT_RAW_ARGS("RequestHeader", header_cmd, &hdr_in, OR_FILEINFO,