bugfix: improved the error handling when recv() fails on the HTTP connection.