Fix an unlikely but possible error case for http connections

Found by coverity