httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@force-elite.com>
Subject Re: Listen directive, port specification
Date Thu, 06 Apr 2006 02:10:10 GMT
Rian Hunter wrote:
> Hi,
> 
> So the Listen directive now takes an optional protocol argument. In the 
> documentation it states that if the protocol isn't specified then if the 
> port number is 443, it is set to "https" otherwise "http".
> 
> This seems like a good idea. What about if the port number is 25, 
> personally I want this to automatically set the protocol to "smtp". Sort 
> of like our own /etc/services. I can of course see this turning into 
> default protocol specifiers for multiple port numbers so I anticipate 
> some type of config file similar to MIMEMagic in the future.

Yes, my vision was for it to use something like /etc/services, but that 
just didn't make sense for the most common case of people putting HTTP 
on a different port.

> But for now, where is the code that set's the protocol to "https" if the 
> port number is 443? I don't see it in the Listen directive handler.

See server/listen.c around line 530:

     /* TODO: set protocol defaults per-Port, eg 25=smtp */
     ap_set_server_protocol(ls, "http");


> Also is there a preferred way for a protocol module to accept a 
> connection? Right now I have a directive "SmtpProtocol" that dictates 
> whether mod_smtpd accepts a connection on a server_rec. There is also 
> ap_get_server_protocol(server_rec *s) that returns the protocol based on 
> the Listen directive. The second way is similar to the way handlers are 
> selected.

Either method can work. mod_ssl currently will pick up anything with the 
protocol "https".

I personally like using
<VirtualHost *:25>
Protocol smtp
</Vh

Rather than each module introducing a slightly different directive for 
their protocol. (For example SmtpProtocol on, SSLEngine on, etc)

-Paul


Mime
View raw message