cpp-netlib/cpp-netlib — pull request #327 by mepahoo (2013-11-24 12:53:36+00:00)
Title: fixed read timeout in chucked content response for sync keep-alive client

After some testing, i noticed the keep-alive sync http client waited about 20 seconds before returning a trivial content (about 111 bytes). I tracked it down to this fix. The problem was that boost::asio::read is called, even if there are enough bytes in the current stream buffer. This causes read to wait until timeout (which on my windows platform was 20 secs, apparently). The fix is to not read if there are enough bytes in the current stream buffer. I am also counting 2 extra bytes for "\r\n" that comes after each chunk.