We were dancing around trying to get RequestHeader (mod_header) to add
the authenticated user to a proxy request. The approaches we found
involved tricking other modules into calling ap_add_common_vars to
apr_table_addn(r->subprocess_env, "REMOTE_USER", r->user);
I decided to simplify by adding %{}r directives à la
RequestHeader set "x-webobjects-remote-user" "%{user}r"
which interrogate the request structure directly. I re-used
the request structure names 'cause, well, why not?
Please try to reply to <[email protected]>. <[email protected]> is a
temporary hack as ezmlm seems to subscribe the address in the
Return-Path: instead of the From: (grr!).
--
-ericP
--- modules/metadata/mod_headers.c.orig 2010-07-17 15:57:08.000000000 +0000
+++ modules/metadata/mod_headers.c 2010-07-17 15:58:36.000000000 +0000
@@ -215,6 +215,33 @@
}
}
+#define mod_header_REQUEST(VAR) \
+ if (!strcmp(a, #VAR)) \
+ return r->VAR ? r->VAR : "(null)"
+#define mod_header_SERVER(VAR) \
+ if (!strcmp(a, #VAR)) \
+ return r->server && r->server->VAR ? r->server->VAR : "(null)"
+static const char *header_request_attribute_var(request_rec *r, char *a)
+{
+ mod_header_REQUEST(the_request);
+ mod_header_REQUEST(protocol);
+ mod_header_REQUEST(hostname);
+ mod_header_REQUEST(method);
+ mod_header_REQUEST(user);
+ mod_header_REQUEST(unparsed_uri);
+ mod_header_REQUEST(uri);
+ mod_header_REQUEST(filename);
+ mod_header_REQUEST(canonical_filename);
+ mod_header_REQUEST(path_info);
+ mod_header_SERVER(defn_name);
+ mod_header_SERVER(server_admin);
+ mod_header_SERVER(server_hostname);
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "unknown RequestHeader variable %%{%s}r", a);
+ return "(null)";
+}
+#undef mod_header_SERVER
+#undef mod_header_REQUEST
+
/*
* Config routines
*/
@@ -842,6 +869,7 @@
register_format_tag_handler("t", (const void *)header_request_time);
register_format_tag_handler("e", (const void *)header_request_env_var);
register_format_tag_handler("s", (const void *)header_request_ssl_var);
+ register_format_tag_handler("r", (const void *)header_request_attribute_var);
return OK;
}