client: respect content-length header when reading data from client socket

Fixes hangs on connections that don't get closed but have no more
response data left.