Skip to content

Commit 5e26ef7

Browse files
committed
add codes
2 parents 580a0db + e910fa4 commit 5e26ef7

File tree

2 files changed

+4
-47
lines changed

2 files changed

+4
-47
lines changed

include/session.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,23 @@ namespace xwebsocket
111111
{
112112
using cmper = xutil::functional::strncasecmper;
113113
make_handshake_ = true;
114+
path_ = http_parser_.url();
115+
114116
auto upgrade = http_parser_.get_header<cmper>("Upgrade");
115117
auto Sec_WebSocket_Key = http_parser_.get_header<cmper>("Sec-WebSocket-Key");
116118
auto Sec_WebSocket_Protocol = http_parser_.get_header<cmper>("Sec-WebSocket-Protocol");
119+
117120
if (!xutil::functional::strcasecmper()(upgrade.c_str(), "websocket")||
118121
Sec_WebSocket_Key.empty())
119122
{
120123
http_buider_.set_status(404);
121124
send_data(http_buider_.build_resp());
122125
on_close();
123126
}
127+
124128
send_data(make_handshake(Sec_WebSocket_Key, Sec_WebSocket_Protocol));
125-
path_ = http_parser_.path();
126129

127130
auto buffer = http_parser_.get_string();
128-
129131
if (buffer.size())
130132
return recv_callback((char*)buffer.c_str(), buffer.size());
131133
}

unit_test/unit_test.vcxproj.filters

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)