]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Allow conditional RequestHeader directives.
authorAndré Malo <nd@apache.org>
Sun, 6 Jun 2004 22:19:38 +0000 (22:19 +0000)
committerAndré Malo <nd@apache.org>
Sun, 6 Jun 2004 22:19:38 +0000 (22:19 +0000)
PR: 27951
Basically submitted by: vincent gryzor.com (Vincent Deffontaines)
Reviewed by: Jeff Trawick, Brad Nicholes, Andr� Malo

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

CHANGES
STATUS
modules/metadata/mod_headers.c

diff --git a/CHANGES b/CHANGES
index e5edbb3ff9fb57619904630fbe3629ad558b19d1..3fa84a3c7c6d3d7bd90567fd7e33e283fb8a63e8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.50
 
+  *) Allow RequestHeader directives to be conditional. PR 27951.
+     [Vincent Deffontaines <vincent gryzor.com>, André Malo]
+
   *) Allow LimitRequestBody to be reset to unlimited. PR 29106
      [André Malo]
 
diff --git a/STATUS b/STATUS
index 9fdd1973eb1fa7bc1b5b654c17f2c38132b86235..f3779235d921298bd89b17523070087c7852d2ea 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -1,5 +1,5 @@
 APACHE 2.0 STATUS:                                              -*-text-*-
-Last modified at [$Date: 2004/06/06 13:23:26 $]
+Last modified at [$Date: 2004/06/06 22:19:38 $]
 
 Release:
 
@@ -161,10 +161,6 @@ PATCHES TO BACKPORT FROM 2.1
             to the Header directive that allows a standard header definition
             to appear for all response types.
 
-    *) mod_headers: Allow conditional RequestHeader directives. PR 27951
-         modules/metadata/mod_headers.c: r1.52
-       +1: nd, trawick, bnicholes
-
     *) Allow URLs for ServerAdmin. PR 28174.
          server/core.c: r1.274
        +1: nd, bnicholes
index b88c485c30cd73fb7e89d6855393d40fef2f6efc..306fa5b66041fdb47fc06a2f7e17b4325688b4d0 100644 (file)
@@ -308,7 +308,7 @@ static char *parse_format_string(apr_pool_t *p, header_entry *hdr, const char *s
 }
 
 /* handle RequestHeader and Header directive */
-static const char *header_inout_cmd(hdr_inout inout, cmd_parms *cmd, void *indirconf,
+static const char *header_inout_cmd(cmd_parms *cmd, void *indirconf,
                               const char *action, const char *inhdr,
                               const char *value, const char* envclause)
 {
@@ -320,6 +320,7 @@ static const char *header_inout_cmd(hdr_inout inout, cmd_parms *cmd, void *indir
     server_rec *s = cmd->server;
     headers_conf *serverconf = ap_get_module_config(s->module_config,
                                                     &headers_module);
+    hdr_inout inout = (hdr_inout)cmd->info;
 
     if (cmd->path) {
         new = (header_entry *) apr_array_push((hdr_in == inout) ? dirconf->fixup_in : dirconf->fixup_out);
@@ -364,9 +365,6 @@ static const char *header_inout_cmd(hdr_inout inout, cmd_parms *cmd, void *indir
 
     /* Handle the envclause on Header */
     if (envclause != NULL) {
-        if (inout != hdr_out) {
-            return "error: envclause (env=...) only valid on Header directive";
-        }
         if (strncasecmp(envclause, "env=", 4) != 0) {
             return "error: envclause should be in the form env=envar";
         }
@@ -386,7 +384,7 @@ static const char *header_inout_cmd(hdr_inout inout, cmd_parms *cmd, void *indir
     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)
 {
@@ -402,15 +400,7 @@ static const char *header_cmd(cmd_parms *cmd, void *indirconf,
     val = *s ? ap_getword_conf(cmd->pool, &s) : NULL;
     envclause = *s ? ap_getword_conf(cmd->pool, &s) : NULL;
 
-    return header_inout_cmd(hdr_out, 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);
+    return header_inout_cmd(cmd, indirconf, action, hdr, val, envclause);
 }
 
 /*
@@ -550,9 +540,9 @@ 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,
+    AP_INIT_RAW_ARGS("Header", header_cmd, (void *)hdr_out, OR_FILEINFO,
                    "an action, header and value followed by optional env clause"),
-    AP_INIT_TAKE23("RequestHeader", request_header_cmd, NULL, OR_FILEINFO,
+    AP_INIT_RAW_ARGS("RequestHeader", header_cmd, (void *)hdr_in, OR_FILEINFO,
                    "an action, header and value"),
     {NULL}
 };