httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Zedlewski <zedlw...@Princeton.EDU>
Subject Yet another discussion and [PATCH] for ap_sendfile
Date Mon, 15 Nov 1999 18:14:40 GMT
Ok, finally I have a patch that actually does everything it should,
including the possibilities of EINTR and EAGAIN returns for sendfile.
I've included the apr_network_io.h patch (for the function def and hdtr_t,
a structure for headers and trailers) and the
apr/network_io/unix/sendrecv.c patch.  I also had to implement ap_sendv
for use with Linux.

    I didn't send in the http_core patch necessary to put this function to
use, though it's pretty much done.  It needs a new ap_get_http_header
function, which is pretty easy.  More importantly and generally, however,
I found it pretty much impossible to come up with a general method for
obtaining an ap_socket_t struct from a given request_rec.  If you drill
down through rec->client->iol->fd on Unix, you can turn that into one, but
I guess the struct request_rec just hasn't been updated to handle APR.
Perhaps an ap_socket_t will just be added to conn_rec in place of some of
the fields already there?
    This version is written to send an arbitrary number of headers and
footers.  This is the general form that was suggested earlier on this
list.  However, only FreeBSD natively supports and arbitrary number of
headers and footers.  Win32, AIX, and HP-UX each support one header and
one footer, while Linux supports none in the sendfile system call.  We
could simplify matters noticeably by only allowing a single header and
footer in ap_sendfile.  Can anyone think of cases where sending more than
one would be very useful?

Other comments:
    I included ap_sendfile functions for HP-UX and FreeBSD which are
generally correct according to the docs for those OSes.  I don't have
access to machines with either, though, so these are non-debugged roadmaps
for someone else to follow.  I didn't even touch AIX, but its API is
basically a cross between FreeBSD's and HP-UX's, and I can do it later if
the current stuff seems all right.
    Sorry there's some extraneous crap in the patch.  I ran it through GNU
indent to get formatting right, and it seems to differ a little bit from
the indenting of the old sendrecv.c.  Just skip down to ap_sendv and
    I have a Win32 version almost done, but I want to get some feedback on
these first.


View raw message