From e0d767625a0bdaf2322c059a2fd4cc52eb8c87bc Mon Sep 17 00:00:00 2001 From: Tobias Pankrath Date: Sat, 18 Sep 2021 15:36:01 +0200 Subject: [PATCH] fix(http2): mask outgoing ws messages as client --- http2.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/http2.d b/http2.d index c53af6d..7817cd5 100644 --- a/http2.d +++ b/http2.d @@ -3293,6 +3293,9 @@ class WebSocket { private ushort port; private bool ssl; + // used to decide if we mask outgoing msgs + private bool isClient; + private MonoTime timeoutFromInactivity; private MonoTime nextPing; @@ -3329,6 +3332,7 @@ class WebSocket { +/ /// Group: foundational void connect() { + this.isClient = true; if(uri.unixSocketPath) socket.connect(new UnixAddress(uri.unixSocketPath)); else @@ -3712,6 +3716,7 @@ class WebSocket { void send(in char[] textData) { WebSocketFrame wss; wss.fin = true; + wss.masked = this.isClient; wss.opcode = WebSocketOpcode.text; wss.data = cast(ubyte[]) textData; wss.send(&llsend); @@ -3723,6 +3728,7 @@ class WebSocket { /// Group: foundational void send(in ubyte[] binaryData) { WebSocketFrame wss; + wss.masked = this.isClient; wss.fin = true; wss.opcode = WebSocketOpcode.binary; wss.data = cast(ubyte[]) binaryData;