On Sun, Oct 24, 2010 at 12:08 AM, Ben Noordhuis <i...@bnoordhuis.nl> wrote:
> On Sun, Oct 24, 2010 at 00:00, Alexander Farber
> <alexander.far...@gmail.com> wrote:
>> I've created a module using bb (the source code at the bottom)
>> and it suffers from the same problem (hijacks the port 80 too).
>> Could it be that "SetHandler" is a wrong directive for protocol handler?
>
> The wrong directive, yes. SetHandler handlers work at the request
> level, protocol handlers at the connection level.
>
>> Also, I do not know, how to check that the
>> "handler is enabled for the current vhost".
>
> From mod_echo.c:
>
>  static int process_echo_connection(conn_rec *c)
>  {
>      EchoConfig *pConfig =
> ap_get_module_config(c->base_server->module_config, &echo_module);
>      if (!pConfig->bEnabled) {
>          return DECLINED;
>      }

So for content handlers the convention is
to use "SetHandler XXX" in httpd.conf and
then at the runtime they check for that string with

if (!r->handler || (strcmp(r->handler, "XXX") != 0)) {
    return DECLINED;
}

But for protocol handlers there is no such convention.
You have to introduce some keyword for httpd.conf
and check for it. Or in my case you could just:

        if (conn->base_server->port != 843)
                return DECLINED;

at the beginning? (seems to work)

Regards
Alex

Reply via email to