修正连 node ws 服务端失败问题 (#1262)

Fix #1251

参考: https://datatracker.ietf.org/doc/html/rfc6455#section-4.2.1
Sec-WebSocket-Key base64 解码后长度应该是 16 字节.
This commit is contained in:
Xiaofeng Wang 2021-12-08 14:17:34 +08:00 committed by GitHub
parent e483424858
commit 54367fef31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,7 +73,7 @@ public:
typedef shared_ptr<HttpWsClient> Ptr; typedef shared_ptr<HttpWsClient> Ptr;
HttpWsClient(ClientTypeImp<ClientType,DataType> &delegate) : _delegate(delegate){ HttpWsClient(ClientTypeImp<ClientType,DataType> &delegate) : _delegate(delegate){
_Sec_WebSocket_Key = encodeBase64(SHA1::encode_bin(makeRandStr(16, false))); _Sec_WebSocket_Key = encodeBase64(makeRandStr(16, false));
setPoller(delegate.getPoller()); setPoller(delegate.getPoller());
} }
~HttpWsClient(){} ~HttpWsClient(){}