Skip to content

Commit 13ee557

Browse files
authored
Respect payload length of ws control messages (#67)
* 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. * Update changelog
1 parent 869296c commit 13ee557

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

edge-ws/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
* Respect payload length of control messages
910

1011
## [0.4.0] - 2025-01-02
1112
* Option to erase the generics from the IO errors

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)