redding/sanford-protocol — pull request #16 by jcredding (2013-02-04 20:55:50+00:00)
Title: Provide `peek` method for connections

This uses `Socket::MSG_PEEK` to look at the first byte of data on
the socket without reading it off. This allows Sanford servers to
check if anything has been written to the connection. Typical
"keep-alive" behavior opens and then immediately closes the
connection. The only way to detect this is to see if
reading/peeking from the socket returns nothing (after waiting).
With this, servers can check for keep-alive requests and handle
them appropriately.

@kellyredding - This is related to redding/sanford#47.