You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Gregory Nicholls <gn...@bellsouth.net> on 2007/02/08 14:20:56 UTC

protocol module ?

  I've been looking at mod-ftpd and mod-pop3 with a view to writing a 
protocol module. What I haven't been able to work out from reading 
these, is how a particular protocol module 'registers' its interest in 
specific connections.
eg. Assume there's 2 protocols being used and we have Listen 8080 http 
and Listen 1234 foo. I use ap_hook_process_connection to insert mod_foo 
into the chain. So far so good but I only want to process connections 
coming on port 1234. Neither mod-ftpd or mod-pop3 seem to have any code 
that examines the connection with a view to declining those they can't 
process. So I'm guessing that there's some mechanism for assigning 
protocols/ports to a specific module. I just don't know how to do it.
       Can some kind soul point out what I've missed please ?
          Thanks,
             Gregory Nicholls


Re: protocol module ?

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
All hooks may see any connection (likewise, with other hooks).  The trick
is how to 'go away' and ignore/decline handling it.

mod_ftp looks for a server's FTP On directive setting in the server host
context to decide to pick up and handle the connection.  Since vhosts
can be configured for VirtualHost _default_:port or VirtualHost IP:port,
this is pretty trivial to unwind if the user places their protocol
related directive in the proper context.  See mod_echo for an example.



Gregory Nicholls wrote:
>  I've been looking at mod-ftpd and mod-pop3 with a view to writing a
> protocol module. What I haven't been able to work out from reading
> these, is how a particular protocol module 'registers' its interest in
> specific connections.
> eg. Assume there's 2 protocols being used and we have Listen 8080 http
> and Listen 1234 foo. I use ap_hook_process_connection to insert mod_foo
> into the chain. So far so good but I only want to process connections
> coming on port 1234. Neither mod-ftpd or mod-pop3 seem to have any code
> that examines the connection with a view to declining those they can't
> process. So I'm guessing that there's some mechanism for assigning
> protocols/ports to a specific module. I just don't know how to do it.
>       Can some kind soul point out what I've missed please ?
>          Thanks,
>             Gregory Nicholls
> 
> .
> 


Re: protocol module ?

Posted by Eli Marmor <ma...@netmask.it>.
Gregory Nicholls wrote:
> 
>   I've been looking at mod-ftpd and mod-pop3 with a view to writing a
> protocol module. What I haven't been able to work out from reading
> these, is how a particular protocol module 'registers' its interest in
> specific connections.
> eg. Assume there's 2 protocols being used and we have Listen 8080 http
> and Listen 1234 foo. I use ap_hook_process_connection to insert mod_foo
> into the chain. So far so good but I only want to process connections
> coming on port 1234. Neither mod-ftpd or mod-pop3 seem to have any code
> that examines the connection with a view to declining those they can't
> process. So I'm guessing that there's some mechanism for assigning
> protocols/ports to a specific module. I just don't know how to do it.
>        Can some kind soul point out what I've missed please ?
>           Thanks,
>              Gregory Nicholls

I don't know if it will help you, but Ryan Bloom dedicated a chapter
for that in his book ("Using Apache to Serve Different Protocols", pp.
383-401).

In addition, mod_ftpd and mod_pop3 are not the only non-httpd protocol
modules, and there are some else, such as mod_smtpd. I wish there was
a mod_named (or mod_dns or mod_bind, I don't care). One day, maybe I'll
write one...

-- 
Eli Marmor
Netmask (El-Mar) Internet Technologies Ltd.
__________________________________________________________
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-5237338          Kfar-Saba 44641, Israel