httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <>
Subject Re: Annoying unusual bug.
Date Tue, 11 Jan 2000 20:59:37 GMT
Ryan Bloom wrote:
> > > So, my solution:
> > > add a char *protocol to the request_rec, and have it default to http.
> > > When the request comes in, if it is anything else, we overwrite this
> > > default.  This also keeps the SSL modules from having to provide this
> > > field in the record (I have been told most of them provide it, but I
> > > haven't checked yet).  This would allow us to register the protocols, and
> > > the rest of the algorithm works properly.
> > >
> > > Any other thoughts?  If not, I will implement this for Apache 2.0 very
> > > soon.
> >
> > Yeah. It should be a hook, surely? In Apache-SSL, ap_default_port(r)
> > determines the appropriate port (by examining stuff in the conn_rec,
> > ISTR), but the generic way is for ap_default_port() to be a hook, and
> > for protocol modules to hook it.
> I don't think it should be a hook.  Why should multiple modules implement
> a function that basically returns an integer?

How do you know, in general, what integer should be returned? I'll admit
I may be overcomplicating it, but I'm not convinced.

>  Plus, how would we know
> which protocol module should be used?  We don't want to check if the port
> used is a default for ANY known protocol, we really want to know if the
> current port is the default port for the current protocol.

Exactly, so only the protocol module for the current protocol should
return a value. Could be that we want a function pointer rather than an
integer or a hook, to achieve complete generality.

> I was basically
> going to:
> add   ap_register_protocol(proto, port)   /* adds info to a global table*/
> in ap_construct_url grab the default port from the global table and check
> it against the current port.

Well, it occurs to me that this doesn't work when ports are dynamically
allocated (e.g. FTP data connections, RTP/RTSP stuff, and so on).

> I think the ap_register_protocol function should be called from the
> register_hooks functions, but it should not be implemented like the other
> hooks are.

I think it should be:

void ap_register_protocol(const char *proto,int
(*get_default_port)(request_rec *r));




"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
     - Indira Gandhi

View raw message