fix bug where http client sometimes wouldn't report connection errors properly