From a75a7899437aafd0cc8aba6fda6eff8e7853818c Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Tue, 18 Oct 2022 19:43:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BA=90=E7=AB=99Websocket?= =?UTF-8?q?=E6=BA=90=E7=AB=99=E8=AF=BB=E5=8F=96=E5=A4=B1=E8=B4=A5=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E5=BC=82=E5=B8=B8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request_websocket.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/nodes/http_request_websocket.go b/internal/nodes/http_request_websocket.go index de6dd0f..c2fe464 100644 --- a/internal/nodes/http_request_websocket.go +++ b/internal/nodes/http_request_websocket.go @@ -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() }