You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2010/12/29 04:08:44 UTC

svn commit: r1053516 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_headers.xml modules/metadata/mod_headers.c

Author: covener
Date: Wed Dec 29 03:08:44 2010
New Revision: 1053516

URL: http://svn.apache.org/viewvc?rev=1053516&view=rev
Log:
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.


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_headers.xml
    httpd/httpd/trunk/modules/metadata/mod_headers.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1053516&r1=1053515&r2=1053516&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Dec 29 03:08:44 2010
@@ -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 <st kino-fahrplan.de>]
 

Modified: httpd/httpd/trunk/docs/manual/mod/mod_headers.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_headers.xml?rev=1053516&r1=1053515&r2=1053516&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_headers.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_headers.xml Wed Dec 29 03:08:44 2010
@@ -300,7 +300,6 @@ 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
@@ -308,16 +307,18 @@ headers</description>
     and output filters are run, allowing outgoing headers to be
     modified.</p>
 
-    <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>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>The action it performs is determined by the first
     argument (second argument if a <var>condition</var> is specified).

Modified: httpd/httpd/trunk/modules/metadata/mod_headers.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/metadata/mod_headers.c?rev=1053516&r1=1053515&r2=1053516&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/metadata/mod_headers.c (original)
+++ httpd/httpd/trunk/modules/metadata/mod_headers.c Wed Dec 29 03:08:44 2010
@@ -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 
     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(req
 
 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,