Skip to content

Commit cbc1a42

Browse files
committed
Respect payload length of ws control messages
Websocket control messages are allowed to have payloads. Don't set the payload lenght to zero when deserializing them, which can corrupt the message and potentially the remainder of the stream.
1 parent 869296c commit cbc1a42

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

edge-ws/src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ impl FrameHeader {
193193

194194
let frame_header = FrameHeader {
195195
frame_type,
196-
payload_len: matches!(
197-
frame_type,
198-
FrameType::Binary(_) | FrameType::Text(_) | FrameType::Continue(_)
199-
)
200-
.then(|| payload_len)
201-
.unwrap_or(0),
196+
payload_len,
202197
mask_key,
203198
};
204199

0 commit comments

Comments
 (0)