Fix two potentially endless loops in http library
Fix two potentially endless loops in http library

The first can be problematic if poll(2) returns POLLHUP|POLLERR on a
socket. Before it would be only be respected for SOCKOP_RECV, but since
they can also occur on other socket operations, esp. in combination with
OpenSSL, letting the socket functions handle POLLHUP|POLLERR seems to be
the right thing.

The second is a typo leading to an endless loop if the first line of an
HTTP connection is empty (simply "\r\n"). Instead of removing the empty
line, it would remove anything after it.

Signed-off-by: Michael Hanselmann <68b67885ff74281219b4a4be33cc20fd45078d7c@google.com>
Reviewed-by: Iustin Pop <acf83a5274f31a43af6b914614365999469c1a31@google.com>

mbakke/ganeti,onponomarev/ganeti,dimara/ganeti,ganeti/ganeti,yiannist/ganeti,ganeti/ganeti,apyrgio/snf-ganeti,dimara/ganeti,apyrgio/snf-ganeti,grnet/snf-ganeti,apyrgio/ganeti,grnet/snf-ganeti,yiannist/ganeti,bitemyapp/ganeti,andir/ganeti,leshchevds/ganeti,yiannist/ganeti,apyrgio/ganeti,andir/ganeti,mbakke/ganeti,andir/ganeti,ganeti-github-testing/ganeti-test-1,bitemyapp/ganeti,ganeti/ganeti,leshchevds/ganeti,mbakke/ganeti,onponomarev/ganeti,ganeti-github-testing/ganeti-test-1,leshchevds/ganeti