This commit is contained in:
aozhiwei 2019-01-02 19:12:46 +08:00
parent a87779569d
commit 0c3e904eec

View File

@ -113,12 +113,10 @@ namespace a8
return;
}
std::string server_key;
const char* key = WEB_SOCKET_KEY;
{
char* p1 = strstr(buf + offset, WEB_SOCKET_KEY);
if (!p1) {
p1 = strstr(buf + offset, WEB_SOCKET_KEY2);
key = WEB_SOCKET_KEY2;
}
if (p1) {
p1 += strlen(WEB_SOCKET_KEY);
@ -136,7 +134,7 @@ namespace a8
std::string response = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"
"Upgrade: websocket\r\n"
"Connection: Upgrade\r\n"
+ std::string(key) + hash_data + "\r\n" +
"Sec-WebSocket-Accept: " + hash_data + "\r\n" +
"\r\n";
SendBuff(response.data(), response.size());
handshook_ = true;