1
This commit is contained in:
parent
91b5f74b3a
commit
0d5c381b38
@ -96,12 +96,10 @@ namespace a8
|
||||
{
|
||||
actived_ = true;
|
||||
connected_ = false;
|
||||
a8::XPrintf("remote_ip:%s remote_port:%d\n", {endpoint_->address().to_string(), endpoint_->port()});
|
||||
socket_->async_connect
|
||||
(*endpoint_,
|
||||
[this] (const asio::error_code& ec)
|
||||
{
|
||||
a8::XPrintf("async econnect %d\n", {ec.value()});
|
||||
HandleConnect(ec);
|
||||
});
|
||||
}
|
||||
|
@ -7,4 +7,9 @@ namespace a8
|
||||
{
|
||||
};
|
||||
|
||||
class NormalPromise : public Awaiter
|
||||
{
|
||||
std::function<(std::shared_ptr<a8::Awaiter>)> cb;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -175,38 +175,11 @@ namespace a8
|
||||
if (!pend) {
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
std::string server_key;
|
||||
{
|
||||
char* p1 = strstr(buf + offset, WEB_SOCKET_KEY);
|
||||
if (!p1) {
|
||||
p1 = strstr(buf + offset, WEB_SOCKET_KEY2);
|
||||
}
|
||||
if (p1) {
|
||||
p1 += strlen(WEB_SOCKET_KEY);
|
||||
char* p2 = strstr(p1 , "\r\n");
|
||||
if (p2) {
|
||||
server_key.append(p1, p2-p1);
|
||||
}
|
||||
}
|
||||
}
|
||||
server_key += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
||||
std::string sha1_data = a8::openssl::Sha1Encode(server_key);
|
||||
std::string hash_data;
|
||||
a8::openssl::Base64Encode(sha1_data, hash_data);
|
||||
|
||||
std::string response = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n"
|
||||
"Upgrade: websocket\r\n"
|
||||
"Connection: Upgrade\r\n"
|
||||
"Sec-WebSocket-Accept: " + hash_data + "\r\n" +
|
||||
"\r\n";
|
||||
SendBuff(response.data(), response.size());
|
||||
handshook_ = true;
|
||||
offset += pend - buf - offset + strlen("\r\n\r\n");
|
||||
if (on_connect) {
|
||||
on_connect(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebSocketClient::ProcessUserPacket()
|
||||
@ -318,7 +291,7 @@ namespace a8
|
||||
|
||||
void WebSocketClient::DecodeUserPacket(char* buf, int& offset, unsigned int buflen)
|
||||
{
|
||||
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user