geemus/excon — pull request #348 by burns (2013-12-19 01:38:06+00:00)
Title: idle timeout detection (work in progress)

For persistent connections with nonblock support, attempt to read from the socket to detect if the server closed the connection. For non-idempotent requests, this allows Excon to re-establish the socket before the request is sent.
There's a simple benchmark in `tests/idle_timeout_performance.rb`.
Performing this socket test adds some overhead, but it's probably worth it for non-idempotent requests.
For idempotent requests, it's faster to allow the initial request to fail and let the middleware retry the request.