From d5f4df409d78bd6efac66255c737ebf7a30c0395 Mon Sep 17 00:00:00 2001 From: qydysky Date: Tue, 8 Oct 2024 08:35:42 +0000 Subject: [PATCH] 1 --- http.go | 4 ++++ ws.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/http.go b/http.go index f43a9f0..fa4307d 100644 --- a/http.go +++ b/http.go @@ -102,6 +102,10 @@ func (httpDealer) Deal(ctx context.Context, w http.ResponseWriter, r *http.Reque chosenBack.Disable() } + if resp == nil { + return ErrResFail + } + if ok, e := chosenBack.getFiliterResHeader().Match(resp.Header); e != nil { logger.Warn(`W:`, fmt.Sprintf(logFormat, r.RemoteAddr, chosenBack.route.config.Addr, routePath, chosenBack.Name, "Err", e, time.Since(opT))) } else if !ok { diff --git a/ws.go b/ws.go index f54fe13..6891adc 100644 --- a/ws.go +++ b/ws.go @@ -80,6 +80,10 @@ func (wsDealer) Deal(ctx context.Context, w http.ResponseWriter, r *http.Request } // } + if conn == nil || resp == nil { + return ErrResFail + } + if pctx.Done(r.Context()) { return context.Canceled } -- 2.39.2