From 1c4a80f1f30327c146dfde859733e227807dedba Mon Sep 17 00:00:00 2001 From: cs-charles <55076335+cs-charles@users.noreply.github.com> Date: Mon, 7 Jun 2021 22:25:09 +0800 Subject: [PATCH] bugfix: fix(#85) (#88) Co-authored-by: charlesxie --- plugins/websocket/ws/ws.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/websocket/ws/ws.go b/plugins/websocket/ws/ws.go index 998a16a..3354b01 100644 --- a/plugins/websocket/ws/ws.go +++ b/plugins/websocket/ws/ws.go @@ -224,6 +224,10 @@ func (u *Upgrader) Upgrade(c *connection.Connection, in *ringbuffer.RingBuffer) err = onRequest(c, req.uri) } } + if err != nil { + return + } + // Start headers read/parse loop. var ( // headerSeen reports which header was seen by setting corresponding @@ -232,7 +236,7 @@ func (u *Upgrader) Upgrade(c *connection.Connection, in *ringbuffer.RingBuffer) nonce = make([]byte, nonceSize) ) for i := 1; i < len(lines); i++ { - if len(lines[i]) == 0 { + if err != nil || len(lines[i]) == 0 { // Blank line, no more lines to read. break }