From 791d84d08eb32edad80b9952517a0d1946c76e5b Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 2 Apr 2019 15:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84websocket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index c569d891..ec303ae4 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -190,6 +190,9 @@ inline bool HttpSession::checkWebSocket(){ headerOut["Upgrade"] = "websocket"; headerOut["Connection"] = "Upgrade"; headerOut["Sec-WebSocket-Accept"] = Sec_WebSocket_Accept; + if(!_parser["Sec-WebSocket-Protocol"].empty()){ + headerOut["Sec-WebSocket-Protocol"] = _parser["Sec-WebSocket-Protocol"]; + } sendResponse("101 Switching Protocols",headerOut,""); return true; }