From b265d65e11f843f42fdb82612407220974961951 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 23 Apr 2016 18:17:55 +0000 Subject: [PATCH] I only support websockets protocol version 13. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3215 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- core/httpd.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/httpd.js b/core/httpd.js index 7fc1cc7f..fdbcb647 100644 --- a/core/httpd.js +++ b/core/httpd.js @@ -285,11 +285,15 @@ function handleWebSocketRequest(request, response, client) { logError(client.peerName + " - - [" + new Date() + "] " + error); }); - response.writeHead(101, { + let headers = { "Upgrade": "websocket", "Connection": "Upgrade", "Sec-WebSocket-Accept": webSocketAcceptResponse(request.headers["sec-websocket-key"]), - }); + }; + if (request.headers["sec-websocket-version"] != "13") { + headers["Sec-WebSocket-Version"] = "13"; + } + response.writeHead(101, headers); } function webSocketAcceptResponse(key) {