httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <>
Subject Patch to implement Keep-Alive
Date Sat, 03 Feb 1996 05:44:35 GMT
Hi folks...

I've uploaded to /httpd/incoming a patch, keepalive.patch, that implements
persistent connections as per the HTTP/1.1 draft - the same way that
NCSA/1.5, Spyglass Server, Netscape Navigator 2.0 and NCSA Mosaic 2.6/X
do. I figure it's about time... (and it was simple, too...  add a while
loop in http_main.c, stick some support code in http_protocol.c and
httpd.h, and viola. Did I miss something?)

Anyhow, near as I can tell, it works. Whenever someone sends the server a
Connection:  Keep-Alive and the response contains a Content-length header,
or has no body (e.g. a HEAD response or a 302 Not Modified), it sends
along a Connection: Keep-Alive in response, and keeps the connection open.
It does this indefinitely, until either they request a document without
sending Keep-Alive, they request a document that has an unknown length,
they close the connection, or it times out.

That last thing is the one problem. See, my knowledge of handling sockets
and TCP and stuff in C isn't great (you want proof? Go read my mod_proxy),
so I didn't fix this (don't know how), but when someone requests a
document with keep-alive, and then just sits there, it sits there until it
times out. Which is whatever you have Timeout set to (400 secs default in
the config files). While you want to keep it open long enough for
reasonable after-requests to be made (inline images, the user has clicked
on a link quickly after loading the page), you don't want a million
clients just keeping connections open to your server and not doing
anything. So the timeout at that one point (once they get sent a
request-line, it should go back to normal) should probably be about 20-30
seconds. If anyone wants to take the patch and make it so that it happens
that way, please do.

Other than that, it does work wonderfully. At least, it seems to. 
According to the spec, at least. I don't really know if it works. I don't
have a browser I can gaurantee actually uses Keep-Alive (Netscape 2.0
sends it, but for all I know it just closes the connection after it gets
the data anyhow), so I can't test that, but it seems to work. If someone
could move the patch over to for_Apache_1.0.2, I'd like to see it there. 

Oh, and I'm leaving town for the weekend, so after tonight I won't read
any replies until Monday.


--/ Alexei Kosut <> /--------/ Lefler on IRC
----------------------------/ <>
The viewpoints expressed above are entirely false, and in no way
represent Alexei Kosut nor any other person or entity. /--------------

View raw message