omg another bug in this broken websocket client

This commit is contained in:
Adam D. Ruppe 2020-09-27 21:59:09 -04:00
parent 3b3d569309
commit dd42e49811
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}