From: Eric Covener Date: Sun, 8 Sep 2013 20:04:06 +0000 (+0000) Subject: add "Header note" which was the solution for two users this week on IRC. X-Git-Tag: 2.5.0-alpha~5090 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46d97009e1351ed3205bbe1894963b8e2367d927;p=apache add "Header note" which was the solution for two users this week on IRC. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1520908 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 6f3d2f98ac..86f55881d9 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_headers: Add 'Header note header-name note-name' for copying a response + headers value into a note. [Eric Covener] + *) WinNT MPM: Don't crash during child process initialization if the Listen protocol is unrecognized. [Jeff Trawick] @@ -80,10 +83,6 @@ Changes with Apache 2.5.0 *) AIX: Install DSO's with "cp" instead of "install" in instdso.sh [Eric Covener] - *) mod_ldap: Retry transient LDAP connection errors when they occur - during the authorization stage. - [Eric Covener] - *) mod_ldap: Don't keep retrying if a new LDAP connection times out. [Eric Covener] diff --git a/docs/manual/mod/mod_headers.xml b/docs/manual/mod/mod_headers.xml index 774cadc4f6..68ba926add 100644 --- a/docs/manual/mod/mod_headers.xml +++ b/docs/manual/mod/mod_headers.xml @@ -300,7 +300,7 @@ Header merge Cache-Control no-store env=NO_STORE Header Configure HTTP response headers -Header [condition] add|append|echo|edit|edit*|merge|set|unset +Header [condition] add|append|echo|edit|edit*|merge|set|unset|note header [value] [replacement] [early|env=[!]variable]|expr=expression] @@ -400,6 +400,13 @@ Header merge Cache-Control no-store env=NO_STORE
The response header of this name is removed, if it exists. If there are multiple headers of the same name, all will be removed. value must be omitted.
+ +
note
+
The value of the named response header is copied into an + internal note whose name is given by value. This is useful + if a header sent by a CGI or proxied resource is configured to be unset + but should also be logged.
+

This argument is followed by a header name, which diff --git a/modules/metadata/mod_headers.c b/modules/metadata/mod_headers.c index 6c03e71839..55cfb50a9b 100644 --- a/modules/metadata/mod_headers.c +++ b/modules/metadata/mod_headers.c @@ -96,8 +96,9 @@ typedef enum { hdr_unset = 'u', /* unset header */ hdr_echo = 'e', /* echo headers from request to response */ hdr_edit = 'r', /* change value by regexp, match once */ - hdr_edit_r = 'R', /* change value by regexp, everymatch */ - hdr_setifempty = 'i' /* set value if header not already present*/ + hdr_edit_r = 'R', /* change value by regexp, everymatch */ + hdr_setifempty = 'i', /* set value if header not already present*/ + hdr_note = 'n' /* set value of header in a note */ } hdr_actions; /* @@ -448,9 +449,11 @@ static APR_INLINE const char *header_inout_cmd(cmd_parms *cmd, new->action = hdr_edit; else if (!strcasecmp(action, "edit*")) new->action = hdr_edit_r; + else if (!strcasecmp(action, "note")) + new->action = hdr_note; else return "first argument must be 'add', 'set', 'setifempty', 'append', 'merge', " - "'unset', 'echo', 'edit', or 'edit*'."; + "'unset', 'echo', 'note', 'edit', or 'edit*'."; if (new->action == hdr_edit || new->action == hdr_edit_r) { if (subs == NULL) { @@ -796,6 +799,10 @@ static int do_headers_fixup(request_rec *r, apr_table_t *headers, apr_table_do(add_them_all, (void *) headers, ed.t, NULL); } break; + case hdr_note: + apr_table_setn(r->notes, process_tags(hdr, r), apr_table_get(headers, hdr->header)); + break; + } } return 1;