You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nick Gearls <ni...@gmail.com> on 2010/11/06 18:19:33 UTC
mod_substitute tags parsing
Hello,
I took the tags parsing code from mod_headers to incorporate it to
mod_substitute.
It almost works, but I cannot obtain the handlers via apr_hash_get() -
even the locally defined ones (%D & %t).
They are all registered:
static int tags_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("D", (const void
*)tags_request_duration);
register_format_tag_handler("t", (const void *)tags_request_time);
register_format_tag_handler("e", (const void
*)tags_request_env_var);
register_format_tag_handler("s", (const void
*)tags_request_ssl_var);
return OK;
}
Any idea what could be the problem?
Btw, I copied the code from mod_headers and it is 98% identical, so I'll
modularise it to be 100% portable between these 2 modules (and others).
The next step will be to remove it from the modules itself and make the
static functions global.
Thanks,
Nick
Re: mod_substitute tags parsing
Posted by Stefan Fritsch <sf...@sfritsch.de>.
On Sat, 6 Nov 2010, Nick Gearls wrote:
> Btw, I copied the code from mod_headers and it is 98% identical, so I'll
> modularise it to be 100% portable between these 2 modules (and others). The
> next step will be to remove it from the modules itself and make the static
> functions global.
This looks very similar to the code in mod_log_config. Maybe it could be
made general enough that all three modules could use the same code?
OTOH, the ErrorLog formatter can probably not use the same code. It has to
work without request_rec or server_req and should not use pools for memory
allocation.
BTW, I have also thought about making it possible to evaluate an ap_expr
to a string. Then one could use a string like "%{ENV:xxx} %{IPV6}".
Would this be a useful alternative?