httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akins, Brian" <>
Subject RFC: replace r->subprocess_env was Re: Patch for implementing ap_document_root as a hook
Date Mon, 23 Apr 2007 21:04:52 GMT
This idea has been rattling around in my head off and on for a while.  What
is we replaced all the r->subprocess_env with something a little more

General "environment" API:

"directly" set an env variable. Will always show up in env list
apr_status_t ap_set_env(request_rec *r, const char *key, const char *val)

Get the value of an env var.
const char *ap_get_env(request_rec *r, const char *key

And the interesting ones:

Set a handler for a given key for env variables.  Can choose whether or not
the key shows up in the list.
apr_status_t ap_set_env_handler(constchar *key, ap_env_func *func, int

Return a list of available (exposed) env variables suitable for iteration
apr_array_header_t *ap_env_list( request_rec *r, const char *key)

ap_env_func would be :
const char* my_env_handler(request_rec*r, const char* key)

This would allow most env variables to be overridden easily.  Also, many env
variables could be set "lazily," ie, only calculate it when someone actually
needs it.  A good example of this is when you occasionally use UNIQUE_ID and
only want the calculation to be done when you actually need it, not on every
single request.

The handler could cache it's results if it wanted.  We may want a flag to
say cache is okay or not. Or do caching in env itself...

The actually handler, could actually be a hook.  For example, the handler
for "DOCUMENT_ROOT" could actually be a wrapper around a hook.


Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies

View raw message