You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by dean gaudet <dg...@arctic.org> on 2000/04/11 00:23:57 UTC

SAFEREAD (was Re: Buff should be an I/O layer)

On Mon, 10 Apr 2000, dean gaudet wrote:

> if you do that against apache-1.3 and the current apache-2.0 you get
> back maximally packed packets.

heh, no 2.0 is broken.  i broke SAFEREAD during the initial mpm work --
and it hasn't been re-implemented yet.

does someone else want to fix this?  it's probably not ideal that i'm the
only person intimately familiar with this code :)

without SAFEREAD, we end up with a packet boundary between every response
in a pipelined connection.

essentially saferead ensures that if we are going to have to block in
read() to get the next request on a connection then we better flush our
output buffer (otherwise we cause a deadlock with non-pipelining clients).  
but if there are more bytes available, then we don't need to flush our
output buffer.

if you search the code for SAFEREAD you'll see i suggest that it might be
implemented as a layer.  i'm not sure what i meant, i don't think this
works.

if you look at 1.3's saferead and bhalfduplex in buff.c you'll see that we
use select() to implement it.  naturally this won't work in 2.0... but
what will work is to set the iol's timeout to 0 and attempt a read.  
underneath the covers this achieves the same result.

-dean