From 537dfb4223a7ca4fc7dd77505c1a338c2f39e176 Mon Sep 17 00:00:00 2001 From: Eximius Date: Mon, 27 Oct 2014 17:22:46 +0000 Subject: [PATCH] Fix Websocket pinging. When vibe.d received a ping frame, it set the frame's opcode to pong and sent the pong message, it broke out of the switch and the loop as well (since the opcode is no longer ping), which left the m_currentFrame in a zeroed out state so Websocket receive complained about unexpected continuation frame and closed the connection. Heartbeat made the connection go away - sweet irony. --- source/vibe/http/websockets.d | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/vibe/http/websockets.d b/source/vibe/http/websockets.d index 40e1c391c3..b35e2e6307 100644 --- a/source/vibe/http/websockets.d +++ b/source/vibe/http/websockets.d @@ -503,8 +503,12 @@ final class IncomingWebSocketMessage : InputStream { m_currentFrame = frame; break; case FrameOpcode.ping: - frame.opcode = FrameOpcode.pong; - frame.writeFrame(m_conn); + Frame pong; + pong.opcode = FrameOpcode.pong; + pong.fin = true; + pong.payload = frame.payload; + + pong.writeFrame(m_conn); break; default: throw new WebSocketException("unknown frame opcode");