Skip to content

Commit

Permalink
Fix unmask logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MarhiievHE committed Nov 10, 2023
1 parent e67f5bd commit c474f02
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ class Frame {
this.#length = (frame.readUInt32BE(2) << 32) + frame.readUInt32BE(4);
}
}

unmask() {
if (!this.#masked) return;
for (let i = 0; i < this.#length; ++i) {
this.#frame[this.#dataOffset + i] ^= this.#mask[i & 3];
}
this.#masked = false;
}

toString() {
Expand Down

0 comments on commit c474f02

Please sign in to comment.