Raise error on unexpected EOF.

Fixes infinite read() loop in the case where the server closes the
connection without sending a valid HTTP response.