]> 127.0.0.1 Git - front/.git/commitdiff
1 v0.1.20241008083741
authorqydysky <qydysky@foxmail.com>
Tue, 8 Oct 2024 08:35:42 +0000 (08:35 +0000)
committerGitHub <noreply@github.com>
Tue, 8 Oct 2024 08:35:42 +0000 (08:35 +0000)
http.go
ws.go

diff --git a/http.go b/http.go
index f43a9f0c4fd67c595c71bc250da1a62d0332ac19..fa4307da3c53860835a4bda356b9cf1e894dc9df 100644 (file)
--- 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 f54fe13bfd5e4626d4409a84f805e9c740733483..6891adc0d7797edf1269fbf5198b2ac2b9b4f461 100644 (file)
--- 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
        }