From 65a212560f280319ca998e9b40c158d03dc6dbdf Mon Sep 17 00:00:00 2001 From: chitownhart Date: Fri, 7 Feb 2020 09:20:59 -0600 Subject: [PATCH] Update websocket.h There's a bug in the payload processing if you receive a message larger than the internal buffer size (4K). You need to move the do_read down so that it keeps on reading (with state_ == Payload) until the entire message is processed and remaining_length_ == 0. Currently you only call do_read if reaminging_length_ == 0 on the first read and message fits in the buffer. --- include/crow/websocket.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/crow/websocket.h b/include/crow/websocket.h index c2dc3f81f..8e30f4064 100644 --- a/include/crow/websocket.h +++ b/include/crow/websocket.h @@ -347,8 +347,9 @@ namespace crow { handle_fragment(); state_ = WebSocketReadState::MiniHeader; - do_read(); } + // Read next data chunk or handle the fragment if done + do_read(); } else {