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 Jon Leighton <jt...@udel.edu> on 2013/11/06 22:13:19 UTC
Can a module control the socket transport protocol? - revisited
I'm revisiting this question (from several months ago), primarily
because I know more now that I did then - though still not enough. :)
There are a couple places in the httpd code that state or imply that
httpd is not restricted to TCP - that other network transport protocols
can be used. In particular, core.c:register_hooks() explicitly mentions
other modules installing alternate network transports, and
http_connection.h mentions the "install_network_transport" hook. I
haven't been able to find any information at all on the
"install_network_transport" hook, and I'm wondering if the comment is
actually meant to refer to alternatives to HTTP, rather than TCP.
I'm also wondering if the comment in core.c refers only to the "core"
being network transport agnostic, and implies nothing about the MPMs,
which appear to me to be effectively hard coded to TCP.
Is it possible to add a loadable module to an MPM? If not, then it seems
like the only option is to create my own MPM. If so, then the trick
would be to get any sockets I create into the MPM's list of listening
sockets, so they can be polled - but even that doesn't seem possible.
The problem as I see it is that one of the key variables (the number of
listening sockets), is private to the MPM.
Does anyone really know if httpd can support alternate transport
protocols? Does the comment in core.c simply indicate that the "core" is
network transport agnostic, and imply nothing about the MPMs?
Thanks for any help/comments on this.
- Jon Leighton
Re: Can a module control the socket transport protocol? - revisited
Posted by "Jonathan T. Leighton" <jt...@udel.edu>.
I think the answer to my question is sort of, but not really. It appears
that httpd can support alternate network transport protocols within
strict limits. The MPMs (at least prefork, worker, and event), all call
ap_setup_listeners() to set various socket options, bind(), and listen()
on all the sockets in the global variable ap_listeners, before setting
up polling. If you want to use something other than TCP, and if you're
content to, and able to, have your sockets use the same socket option
settings, bind(), and listen() calls that are used for TCP sockets, then
you just need to create a configuration command that creates and adds
your sockets to ap_listeners.
There is an additional concern that the Listen configuration command
naturally assumes it's the only game in town. When it tries to reuse old
listeners, it only checks the address and port - not the transport
protocol. Thus, it could try to reuse a TCP socket that you wanted
changed to another protocol, or vice verse.
This isn't really supporting alternate network transport protocols.
- Jon Leighton
On 11/6/13 4:13 PM, Jon Leighton wrote:
> I'm revisiting this question (from several months ago), primarily
> because I know more now that I did then - though still not enough. :)
>
> There are a couple places in the httpd code that state or imply that
> httpd is not restricted to TCP - that other network transport
> protocols can be used. In particular, core.c:register_hooks()
> explicitly mentions other modules installing alternate network
> transports, and http_connection.h mentions the
> "install_network_transport" hook. I haven't been able to find any
> information at all on the "install_network_transport" hook, and I'm
> wondering if the comment is actually meant to refer to alternatives to
> HTTP, rather than TCP.
>
> I'm also wondering if the comment in core.c refers only to the "core"
> being network transport agnostic, and implies nothing about the MPMs,
> which appear to me to be effectively hard coded to TCP.
>
> Is it possible to add a loadable module to an MPM? If not, then it
> seems like the only option is to create my own MPM. If so, then the
> trick would be to get any sockets I create into the MPM's list of
> listening sockets, so they can be polled - but even that doesn't seem
> possible. The problem as I see it is that one of the key variables
> (the number of listening sockets), is private to the MPM.
>
> Does anyone really know if httpd can support alternate transport
> protocols? Does the comment in core.c simply indicate that the "core"
> is network transport agnostic, and imply nothing about the MPMs?
>
> Thanks for any help/comments on this.
>
> - Jon Leighton