aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket/frames.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2019-03-06 14:28:06 +0700
committerShulhan <ms@kilabit.info>2019-03-06 14:28:06 +0700
commit0ef44ffb17dc9f292ca2a5b581f864572ba65962 (patch)
treeb1b0de7085b7a5486d4f5a13a007665ecb502d43 /lib/websocket/frames.go
parent257407980ab8ae813824ca8a490d911867323371 (diff)
downloadpakakeh.go-0ef44ffb17dc9f292ca2a5b581f864572ba65962.tar.xz
websocket: ignore control frame when concatenating payload
Control frame actually directly handled by server when processing received frames from client. This condition is just to make sure that we are not messing the payload in case the Frames is used by client.
Diffstat (limited to 'lib/websocket/frames.go')
-rw-r--r--lib/websocket/frames.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/websocket/frames.go b/lib/websocket/frames.go
index 6458f8da..2f9dd239 100644
--- a/lib/websocket/frames.go
+++ b/lib/websocket/frames.go
@@ -109,6 +109,11 @@ func (frames *Frames) Payload() (payload []byte) {
break
}
+ // Ignore control PING or PONG frame.
+ if frames.v[x].opcode == opcodePing || frames.v[x].opcode == opcodePong {
+ continue
+ }
+
payload = append(payload, frames.v[x].payload...)
if frames.v[x].fin == frameIsFinished {