Suggested patch to make minor enhancements to mod_headers. This is in addition to: Revision 452330, Oct 3 2006 by niq - "Support regexp-based manipulation of HTTP headers" 1. Allow hdr= which works much like env=. Inspects a request header when used with RequestHeader, inspects a response header when used with Header. Not a big deal for RequestHeader because SetEnvIf can sometimes be used. More useful with Header because SetEnvIf cannot inspect response headers. 2. Allow either env= or hdr= to optionally contain a regex to match the value, e.g. Header add MyHeader somethingNew env=myVariable~[a-z]123 will add a new header only if the environment variable myVariable exists and its value contains a lowercase letter followed by "123". 3. Adds 5 new format specifiers in addition to %t and %D. time (1) and duration (2) without the "t=" or "D=" strings, time in RFC822 fmt (3), hostname (4), servername (5). 4. Lots of module comments (which might help the doc effort) Pls feel free to close or select any useful bits of this patch. An example of a situation which might use this is http://mail-archives.apache.org/mod_mbox/httpd-users/200611.mbox/%3c454B7314.5050500@nerdshack.com%3e (...Not related to this patch - I just happened to notice this post...) This code has been pretty well exercised with 2.2.3, but only limited testing with trunk. The patch is for the trunk as of Nov 5, 2006.
Created attachment 19089 [details] mod_headers_enh.diff mod_headers patch - based on trunk/modules/metadata/mod_headers.c - Nov 5, 2006
Tom, you've got commit since submitting this patch, so you can pursue it if you're still interested. Closing this PR because most of it is superseded in trunk by switching the condition-processing to ap_expr in place of what you enhanced. The format stuff would benefit from a similar effort, as noted by wrowe in a comment to Bug 47447