网络套接字握手
我正在使用 c++ 编写一个 websocket 服务器,我正在握手中使用 chrome 17 作为客户端。
当服务器向客户端发送握手响应时,chrome 总是在控制台中显示以下错误:
WebSocket 握手期间出错:Sec-WebSocket-Accept 不匹配
chrome 中的事件如下:
t=1328796971951 [st= 5] WEB_SOCKET_SEND_REQUEST_HEADERS
--> GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: 127.0.0.1:38950
Origin: null
Sec-WebSocket-Key: zMb+UCeRb+2OmMp9fpbxHw==
Sec-WebSocket-Version: 13
t=1328796971951 [st= 5] SOCKET_STREAM_SENT
t=1328796971971 [st=25] SOCKET_STREAM_RECEIVED
t=1328796971971 [st=25] WEB_SOCKET_READ_RESPONSE_HEADERS
--> HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: 4emBYsdkl0SxeUMGLNc0dFsI1/E=
t=1328796971972 [st=26] -REQUEST_ALIVE
请帮忙。
I'm writing a websocket server using c++,I was pending in the handshake use chrome 17 as the client.
When the server send client the handshake response chrome always show the error below in console:
Error during WebSocket handshake: Sec-WebSocket-Accept mismatch
The event in chrome is as below:
t=1328796971951 [st= 5] WEB_SOCKET_SEND_REQUEST_HEADERS
--> GET / HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: 127.0.0.1:38950
Origin: null
Sec-WebSocket-Key: zMb+UCeRb+2OmMp9fpbxHw==
Sec-WebSocket-Version: 13
t=1328796971951 [st= 5] SOCKET_STREAM_SENT
t=1328796971971 [st=25] SOCKET_STREAM_RECEIVED
t=1328796971971 [st=25] WEB_SOCKET_READ_RESPONSE_HEADERS
--> HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: 4emBYsdkl0SxeUMGLNc0dFsI1/E=
t=1328796971972 [st=26] -REQUEST_ALIVE
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Sec-WebSocket-Accept 值未正确计算。
如何计算该值(伪代码):
获取更多信息此处< /a>
The
Sec-WebSocket-Accept
value is not correctly calculated.How to calculate the value (pseudocode):
Get more informations here