]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
add a new option '%{note-name}e' to headers.
authorIan Holsman <ianh@apache.org>
Wed, 7 Nov 2001 19:25:33 +0000 (19:25 +0000)
committerIan Holsman <ianh@apache.org>
Wed, 7 Nov 2001 19:25:33 +0000 (19:25 +0000)
This will output the value of the note (subprocess_env) into a header field

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

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

index be2e1f80bdd7a15532d07487785b0ab3d316c67e..513fe6b0289a12f57114b75d76096bc58db5b065 100644 (file)
 %D:     The time from when the request was received to the time the
         headers are sent on the wire. This is a measure of the
     duration of the request. The value is preceded by "D=".
+%{NOTE-NAME}e: The value of the note 'NOTE-NAME' (set via 
+    mod_include's set SSI command)
 </pre>
 
     <p>When the <code>Header</code> directive is used with the
index ebd0901e028f9559c5b3fe8c7a7823098047ca67..2c3c727f53f844a83d4125cbe7165af237a937da 100644 (file)
@@ -188,7 +188,15 @@ static const char *header_request_time(request_rec *r, char *a)
 {
     return apr_psprintf(r->pool, "t=%qd", r->request_time);
 }
-
+static const char *header_request_env_var(request_rec *r, char *a)
+{
+    char *s = apr_table_get(r->subprocess_env,a);
+                
+    if (s)
+        return s;
+    else
+        return "(null)";
+}
 /*
  * Config routines
  */
@@ -289,6 +297,12 @@ static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa)
         return parse_misc_string(p, tag, sa);
     }
     s++; /* skip the % */
+    tag->arg = '\0';
+    /* grab the argument if there is one */
+    if (*s == '{') {
+        ++s;
+        tag->arg = ap_getword(p,&s,'}');
+    }
 
     tag_handler = (const char * (*)(request_rec *,char *))apr_hash_get(format_tag_hash, s++, 1);
 
@@ -302,7 +316,6 @@ static char *parse_format_tag(apr_pool_t *p, format_tag *tag, const char **sa)
     tag->func = tag_handler;
 
     *sa = s;
-    tag->arg = '\0';
     return NULL;
 }
 
@@ -597,6 +610,7 @@ static void header_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp
     format_tag_hash = apr_hash_make(p);
     register_format_tag_handler(p, "D", (void*) header_request_duration, 0);
     register_format_tag_handler(p, "t", (void*) header_request_time, 0);
+    register_format_tag_handler(p, "e", (void*) header_request_env_var, 0);
 }
 
 static void register_hooks(apr_pool_t *p)