]> granicus.if.org Git - apache/commitdiff
Change the default of the Header directive to apply to responses of all types
authorEric Covener <covener@apache.org>
Fri, 5 Nov 2010 17:20:31 +0000 (17:20 +0000)
committerEric Covener <covener@apache.org>
Fri, 5 Nov 2010 17:20:31 +0000 (17:20 +0000)
instead of just 2xx successful responses.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1031670 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/mod/mod_headers.xml
modules/metadata/mod_headers.c

index e559a3c0d732c204eb9f798215d46efb983036d2..8371fc22938692d38330b7b5ef02c09e5b3c5735 100644 (file)
@@ -300,6 +300,7 @@ headers</description>
 <contextlist><context>server config</context><context>virtual host</context>
 <context>directory</context><context>.htaccess</context></contextlist>
 <override>FileInfo</override>
+<compatibility>Default condition changes in 2.3.9 from "onsuccess" to "always"</compatibility>
 
 <usage>
     <p>This directive can replace, merge or remove HTTP response
@@ -307,18 +308,16 @@ headers</description>
     and output filters are run, allowing outgoing headers to be
     modified.</p>
 
-    <p>By default, this directive only affects successful responses (responses
-    in the <code>2<var>xx</var></code> range).  The optional <var>condition</var>
-    can be either <code>onsuccess</code> (default) or <code>always</code> (all
-    status codes, including successful responses).  A value of <code>always</code>
-    may be needed to influence headers set by some internal modules even for
-    successful responses, and is always needed to affect non-<code>2<var>xx</var></code> 
-    responses such as redirects or client errors.</p>
-
-    <note><title>CGI</title>
-      <p>To manipulate headers set by CGI scripts, it is necessary to specify 
-      <code>always</code> for the first parameter.</p>
-    </note>
+    <p> 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 <code>2<var>xx</var>
+    </code> responses.</p>
+
+    <p>An effective value of <code>always</code> may be needed to influence 
+    headers set by some internal modules (such as <module>mod_cgi</module>) 
+    even for successful responses, and is always needed to affect 
+    non-<code>2<var>xx</var></code> responses such as redirects or client 
+    errors.</p>
 
     <p>The action it performs is determined by the first
     argument (second argument if a <var>condition</var> is specified).
index 2e0c2813f0aee7321aca33fc12afb40437d37044..b02ed715af03f1914b60e6dcd17dd9ce89974833 100644 (file)
@@ -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 */
+static char hdr_out_always = '2';  /* Header always (default) */
 
 /* Callback function type. */
 typedef const char *format_tag_fn(request_rec *r, char *a);
@@ -521,12 +521,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_onsuccess) {
-        if (!strcasecmp(action, "always")) {
-            cmd->info = &hdr_out_always;
+    if (cmd->info == &hdr_out_always) {
+        if (!strcasecmp(action, "onsuccess")) {
+            cmd->info = &hdr_out_onsuccess;
             action = ap_getword_conf(cmd->temp_pool, &args);
         }
-        else if (!strcasecmp(action, "onsuccess")) {
+        else if (!strcasecmp(action, "always")) {
             action = ap_getword_conf(cmd->temp_pool, &args);
         }
     }
@@ -860,7 +860,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_onsuccess, OR_FILEINFO,
+    AP_INIT_RAW_ARGS("Header", header_cmd, &hdr_out_always, 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,