diff options
| author | Shulhan <ms@kilabit.info> | 2019-03-06 14:28:06 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2019-03-06 14:28:06 +0700 |
| commit | 0ef44ffb17dc9f292ca2a5b581f864572ba65962 (patch) | |
| tree | b1b0de7085b7a5486d4f5a13a007665ecb502d43 /lib/websocket/frames.go | |
| parent | 257407980ab8ae813824ca8a490d911867323371 (diff) | |
| download | pakakeh.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.go | 5 |
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 { |
