apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: [PATCH] APR Socket IOL
Date Thu, 08 Nov 2001 21:24:38 GMT
On Thursday 08 November 2001 12:28 pm, Bill Stoddard wrote:
> > On Thursday 08 November 2001 07:32 am, Bill Stoddard wrote:
> <snip>
>
> > > Comments?
> >
> > What is this supposed to be used for?  I'm still not sure that this is
> > necessary.
>
> Sander and I both have similar requirements.  Here are mine...
>
> 1. My SSL library implements socket style secure APIs (eg, secure_read,
> secure_write, et. al). These APIs are semantically identical to BSD socket
> APIs.
>
> 2. I have this little kernel accellerator that, on windows, implements it's
> own BSD like socket API. It implements calls like afpa_read, afpa_write,
> etc. Again, this API is semantically identical to BSD sockets.
>
> The socket IOL makes implementing my SSL and AFPA modules significantly
> cleaner. Without iol, I am forced to modify the APR code. For every network
> i/o call in APR, I need to add code that looks something like this:
>
> if (sock->type == AFPA_SOCK) {
>        code;
>        afpa_sock_blah()
> } else if (sock->type == SSL_SOCK) {
>        code;
>        ssl_sock_blah()
> }
> else
> {
>        bsd_sock_blah()
> }
>
> With the socket IOL, I can isolate all my modules code within my module and
> not touch the rest of the server or APR. I think I may need a couple of
> additional APIs to push and pop IOL's. For instance, my SSL code uses BSD
> accept() (nothing new there). In the pre_connection hook, I can detect if
> the server is enabled for SSL and push the appropriate IOL onto the socket
> for all subsequent network io calls.

All of this can be done with a new output_filter that does the writes.  That
output filter would replace the core_output_filter.  In fact, one of the reasons
that filters were designed they way they were, was to allow for this type of
thing to work.  By creating the socket_IOL, you are just creating a second
way to do the same thing.

The obvious argument for not using a separate filter is that it requires a lot
of logic to be duplicated.  I would argue that isn't true.  Most of the 
core_output_filter is doing stuff that doesn't make sense with AFPA or the
SSL library, unless those libraries replicate sendfile.

Ryan

 
______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message