Whilst looking through the httpd code, I noticed this too. I meant to
send off a "bug" report to Rob, but never got around to it. This is
pretty expensive way to go about things. Sure, a big Sparc II can
crank through read calls at 100,000 per second, but at around 1000
characters per HTTP/1.0 header it adds up.
This is done because it wants to hand off the file descriptor to
CGI scripts that handle POSTs. I'd suggest the right way to fix
things is to read a bufferful and cat the extra to the scripts that
need it. However, a quick hack could double the speed by doing
read(f, &s[i], 2) because you know that at least CR LF will terminate
the line. If it's the header boundary that's a problem, you could
quadruple the speed with read(f, &s[i], 4) since you have at least
"GET " for HTTP/0.9 requests and HTTP/1.0 headers will terminate
with CR LF CR LF (well, they better!).
-- George