You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Dmitry Potapov <po...@gmail.com> on 2013/01/07 15:20:07 UTC

How to force per-location configuration directive presence?

Hello,

I'm implementing module which intended to translate particular
HTTP-requests into TCP-messages to 3rd party server, and I want to force
per-location server address and port presence at post_config stage.
For example, having config:

LoadModule myproxy_module libmyproxymodule.so
MyProxyPort 8080
<Location /master>
    SetHandler myproxy
    MyProxyServer master.example.com
</Location>
<Location /slave>
    SetHandler myproxy
    MyProxyServer slave.example.com
</Location>

I wan't to ensure that all locations handled by myproxy_module have both
MyProxyServer and MyProxyPort. And I wan't this check to be done at
post_config, because this way I'll can check that httpd.conf is sane,
without server restart.

For now, I have only one hack-around to do this:
1. implement create_server_config and allocate array inside it
2. at the end of each create_dir_config and merge_dir_config, store result
inside aforementioned array (and remove `base' and `add' configs from it)
3. in the post_config I will retrieve server config, iterate over all
dir_configs and check their validity

Unfortunately this seem to be very ugly solution.
So, my question is: how to force each location handled by particular
handler to have complete dir_config?

-- 
Thanks in advance,
Dmitry