From dd42e4981169895c4fe94fe66eee34c6aa86c213 Mon Sep 17 00:00:00 2001 From: "Adam D. Ruppe" Date: Sun, 27 Sep 2020 21:59:09 -0400 Subject: [PATCH] omg another bug in this broken websocket client --- http2.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/http2.d b/http2.d index c31f872..19f1466 100644 --- a/http2.d +++ b/http2.d @@ -2813,6 +2813,7 @@ class WebSocket { private WebSocketFrame processOnce() { ubyte[] d = receiveBuffer[0 .. receiveBufferUsedLength]; + //import std.stdio; writeln(d); auto s = d; // FIXME: handle continuation frames more efficiently. it should really just reuse the receive buffer. WebSocketFrame m; @@ -2876,7 +2877,10 @@ class WebSocket { default: // ignore though i could and perhaps should throw too } } - receiveBufferUsedLength -= s.length - d.length; + + import core.stdc.string; + memmove(receiveBuffer.ptr, d.ptr, d.length); + receiveBufferUsedLength = d.length; return m; }