You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Michal Szymaniak <ms...@mimuw.edu.pl> on 2002/03/19 16:18:42 UTC

[2bugs] socket types and socket private data

Hi,

Although you never respond to my questions, I continue my adventure
with Apache ;-)

This time I would like to inform you about two weird things in
httpd-2.0.32. First: in apr there are functions apr_socket_data_set/get.
This name can be misleading, as they do not associate the data with
the socket, but with the pool where the socket resides. If I create
two sockets in the process pool (because they should survive restarts),
they will share the same data. Therefore, these functions cannot be used
to implement any socket-private user data, or to distinguish between sockets.

And the distinguishing is another thing: at the moment it is not possible
to distiguish between TCP and UDP socket using the same local address and
port. In particular, routine reusing sockets in server/listen.c can reuse
UDP socket from local port 80 and try to use it as a main http socket.
Funny thing - probably on each architecture-version of the apr_socket_t
structure there is a 'type' field. However, it inaccessible for a module
without including the architecture-dependent networkio.h header (which is
bad by nature). A simple apr_socket_type function would do..

Regards,
M.
--
+------------------------ ---- -- -- -  -     -   
: Michal Szymaniak | mailto:mszyman@mimuw.edu.pl
.


Re: [2bugs] socket types and socket private data

Posted by Jeff Trawick <tr...@attglobal.net>.
Michal Szymaniak <ms...@mimuw.edu.pl> writes:

>               First: in apr there are functions apr_socket_data_set/get.
> This name can be misleading, as they do not associate the data with
> the socket, but with the pool where the socket resides. If I create
> two sockets in the process pool (because they should survive restarts),
> they will share the same data. Therefore, these functions cannot be used
> to implement any socket-private user data, or to distinguish between
> sockets.

my suggestion: post the description of the first issue to
dev@apr.apache with subject "apr_socket_data_set/get" broken; patch
optional 

> And the distinguishing is another thing: at the moment it is not possible
> to distiguish between TCP and UDP socket using the same local address and
> port. In particular, routine reusing sockets in server/listen.c can reuse
> UDP socket from local port 80 and try to use it as a main http socket.
> Funny thing - probably on each architecture-version of the apr_socket_t
> structure there is a 'type' field. However, it inaccessible for a module
> without including the architecture-dependent networkio.h header (which is
> bad by nature). A simple apr_socket_type function would do..

my suggestion: post the description of the second issue to
dev@apr.apache.org with subject "need to find type of socket"; patch
optional, but it is simple so why not?  I'd suggest
apr_socket_type_get() as the name.

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...