From 54367fef311ec29a77233cfc7e6a9bf6f774523a Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang <1237906+wasphin@users.noreply.github.com> Date: Wed, 8 Dec 2021 14:17:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=BF=9E=20node=20ws=20?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E7=AB=AF=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#1262)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #1251 参考: https://datatracker.ietf.org/doc/html/rfc6455#section-4.2.1 Sec-WebSocket-Key base64 解码后长度应该是 16 字节. --- src/Http/WebSocketClient.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/WebSocketClient.h b/src/Http/WebSocketClient.h index 5031ff0f..4da0197e 100644 --- a/src/Http/WebSocketClient.h +++ b/src/Http/WebSocketClient.h @@ -73,7 +73,7 @@ public: typedef shared_ptr Ptr; HttpWsClient(ClientTypeImp &delegate) : _delegate(delegate){ - _Sec_WebSocket_Key = encodeBase64(SHA1::encode_bin(makeRandStr(16, false))); + _Sec_WebSocket_Key = encodeBase64(makeRandStr(16, false)); setPoller(delegate.getPoller()); } ~HttpWsClient(){}