httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/metadata mod_headers.c
Date Fri, 11 Jun 2004 21:41:27 GMT
nd          2004/06/11 14:41:27

  Modified:    .        CHANGES
               modules/metadata mod_headers.c
  Log:
  Drop the ErrorHeader directive which turned out to be a misnomer.
  Instead there's a new optional flag for the Header directive
  ('always'), which keeps the former ErrorHeader functionality.
  
  The opposite flag to 'always' is 'onsuccess'. So the new directives are written
  as:
  
  Header set foo bar
  # which is the same as
  Header onsuccess set foo bar
  # and a subset of
  Header always set foo bar
  # which is what the ErrorHeader directive did.
  
  Reviewed by: Brad Nicholes
  
  Revision  Changes    Path
  1.1515    +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1514
  retrieving revision 1.1515
  diff -u -u -r1.1514 -r1.1515
  --- CHANGES	11 Jun 2004 21:07:10 -0000	1.1514
  +++ CHANGES	11 Jun 2004 21:41:26 -0000	1.1515
  @@ -2,6 +2,11 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Drop the ErrorHeader directive which turned out to be a misnomer.
  +     Instead there's a new optional flag for the Header directive
  +     ('always'), which keeps the former ErrorHeader functionality.
  +     [André Malo]
  +
     *) mod_deflate: Don't deflate responses with zero length 
        e.g. proxied 304's [Allan Edwards]
   
  
  
  
  1.60      +17 -11    httpd-2.0/modules/metadata/mod_headers.c
  
  Index: mod_headers.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_headers.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -u -r1.59 -r1.60
  --- mod_headers.c	18 Apr 2004 20:26:07 -0000	1.59
  +++ mod_headers.c	11 Jun 2004 21:41:27 -0000	1.60
  @@ -95,8 +95,8 @@
    * magic cmd->info values
    */
   static char hdr_in  = '0';  /* RequestHeader */
  -static char hdr_out = '1';  /* Header */
  -static char hdr_err = '2';  /* ErrorHeader */
  +static char hdr_out = '1';  /* Header onsuccess */
  +static char hdr_err = '2';  /* Header always */
   
   /*
    * There is an array of struct format_tag per Header/RequestHeader 
  @@ -413,7 +413,7 @@
               value = NULL;
           }
           if (cmd->info != &hdr_out && cmd->info != &hdr_err)
  -            return "Header echo only valid on Header and ErrorHeader "
  +            return "Header echo only valid on Header "
                      "directives";
           else {
               regex = ap_pregcomp(cmd->pool, hdr, REG_EXTENDED | REG_NOSUB);
  @@ -459,13 +459,22 @@
       const char *envclause;
   
       action = ap_getword_conf(cmd->pool, &args);
  +    if (cmd->info == &hdr_out) {
  +        if (!strcasecmp(action, "always")) {
  +            cmd->info = &hdr_err;
  +            action = ap_getword_conf(cmd->pool, &args);
  +        }
  +        else if (!strcasecmp(action, "onsuccess")) {
  +            action = ap_getword_conf(cmd->pool, &args);
  +        }
  +    }
       hdr = ap_getword_conf(cmd->pool, &args);
       val = *args ? ap_getword_conf(cmd->pool, &args) : NULL;
       envclause = *args ? ap_getword_conf(cmd->pool, &args) : NULL;
   
       if (*args) {
           return apr_pstrcat(cmd->pool, cmd->cmd->name,
  -                           " takes only 4 arguments at max.", NULL);
  +                           " has too many arguments", NULL);
       }
   
       return header_inout_cmd(cmd, indirconf, action, hdr, val, envclause);
  @@ -599,7 +608,7 @@
   }
   
   /*
  - * Make sure we propagate any ErrorHeader settings on the error
  + * Make sure we propagate any "Header always" settings on the error
    * path through http_protocol.c.
    */
   static apr_status_t ap_headers_error_filter(ap_filter_t *f,
  @@ -613,7 +622,7 @@
                    "headers: ap_headers_error_filter()");
   
       /*
  -     * Add any header fields defined by ErrorHeader to r->err_headers_out.
  +     * Add any header fields defined by "Header always" to r->err_headers_out.
        * Server-wide first, then per-directory to allow overriding.
        */
       do_headers_fixup(f->r, f->r->err_headers_out, dirconf->fixup_err);
  @@ -646,12 +655,9 @@
   static const command_rec headers_cmds[] =
   {
       AP_INIT_RAW_ARGS("Header", header_cmd, &hdr_out, OR_FILEINFO,
  -                     "an action, header and value followed by optional env "
  -                     "clause"),
  +                     "an optional condition, an action, header and value "
  +                     "followed by optional env clause"),
       AP_INIT_RAW_ARGS("RequestHeader", header_cmd, &hdr_in, OR_FILEINFO,
  -                     "an action, header and value followed by optional env "
  -                     "clause"),
  -    AP_INIT_RAW_ARGS("ErrorHeader", header_cmd, &hdr_err, OR_FILEINFO,
                        "an action, header and value followed by optional env "
                        "clause"),
       {NULL}
  
  
  

Mime
View raw message