From: Ian Holsman Date: Wed, 7 Nov 2001 19:25:33 +0000 (+0000) Subject: add a new option '%{note-name}e' to headers. X-Git-Tag: 2.0.28~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a6499811345456361c2ebd340771f28fe8c8caf;p=thirdparty%2Fapache%2Fhttpd.git add a new option '%{note-name}e' to headers. 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 --- diff --git a/docs/manual/mod/mod_headers.html b/docs/manual/mod/mod_headers.html index be2e1f80bdd..513fe6b0289 100644 --- a/docs/manual/mod/mod_headers.html +++ b/docs/manual/mod/mod_headers.html @@ -277,6 +277,8 @@ %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)

When the Header directive is used with the diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index ebd0901e028..2c3c727f53f 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -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)