修复源站Websocket源站读取失败导致的异常错误

This commit is contained in:
GoEdgeLab
2022-10-18 19:43:53 +08:00
parent f4909f0cb5
commit a75a789943

View File

@@ -115,8 +115,8 @@ func (this *HTTPRequest) doWebsocket(requestHost string, isLastRetry bool) (shou
// 读取第一个响应
var respReader = NewWebsocketResponseReader(originConn)
resp, err := http.ReadResponse(bufio.NewReader(respReader), this.RawReq)
if err != nil {
if resp.Body != nil {
if err != nil || resp == nil {
if resp != nil && resp.Body != nil {
_ = resp.Body.Close()
}