forked from boostorg/beast
1 parent
65932ee343
commit
8f627b0748
15 files changed
+99
-97
No files matched your search
@@ -164,12 +164,12 @@ build_request(detail::sec_ws_key_type& key,
|
||||
req.target(target);
|
||||
req.version = 11;
|
||||
req.method(http::verb::get);
|
||||
req.insert(http::field::host, host);
|
||||
req.insert(http::field::upgrade, "websocket");
|
||||
req.insert(http::field::connection, "upgrade");
|
||||
req.set(http::field::host, host);
|
||||
req.set(http::field::upgrade, "websocket");
|
||||
req.set(http::field::connection, "upgrade");
|
||||
detail::make_sec_ws_key(key, maskgen_);
|
||||
req.insert(http::field::sec_websocket_key, key);
|
||||
req.insert(http::field::sec_websocket_version, "13");
|
||||
req.set(http::field::sec_websocket_key, key);
|
||||
req.set(http::field::sec_websocket_version, "13");
|
||||
if(pmd_opts_.client_enable)
|
||||
{
|
||||
detail::pmd_offer config;
|
||||
@@ -186,7 +186,7 @@ build_request(detail::sec_ws_key_type& key,
|
||||
}
|
||||
decorator(req);
|
||||
if(! req.count(http::field::user_agent))
|
||||
req.insert(http::field::user_agent,
|
||||
req.set(http::field::user_agent,
|
||||
BEAST_VERSION_STRING);
|
||||
return req;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ build_response(http::header<true, Fields> const& req,
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(BEAST_VERSION_STRING) < 20);
|
||||
static_string<20> s(BEAST_VERSION_STRING);
|
||||
res.insert(http::field::server, s);
|
||||
res.set(http::field::server, s);
|
||||
}
|
||||
};
|
||||
auto err =
|
||||
@@ -245,7 +245,7 @@ build_response(http::header<true, Fields> const& req,
|
||||
response_type res;
|
||||
res.result(http::status::upgrade_required);
|
||||
res.version = req.version;
|
||||
res.insert(http::field::sec_websocket_version, "13");
|
||||
res.set(http::field::sec_websocket_version, "13");
|
||||
res.prepare();
|
||||
decorate(res);
|
||||
return res;
|
||||
@@ -261,12 +261,12 @@ build_response(http::header<true, Fields> const& req,
|
||||
}
|
||||
res.result(http::status::switching_protocols);
|
||||
res.version = req.version;
|
||||
res.insert(http::field::upgrade, "websocket");
|
||||
res.insert(http::field::connection, "upgrade");
|
||||
res.set(http::field::upgrade, "websocket");
|
||||
res.set(http::field::connection, "upgrade");
|
||||
{
|
||||
detail::sec_ws_accept_type accept;
|
||||
detail::make_sec_ws_accept(accept, key);
|
||||
res.insert(http::field::sec_websocket_accept, accept);
|
||||
detail::sec_ws_accept_type acc;
|
||||
detail::make_sec_ws_accept(acc, key);
|
||||
res.set(http::field::sec_websocket_accept, acc);
|
||||
}
|
||||
decorate(res);
|
||||
return res;
|
||||
@@ -290,9 +290,9 @@ do_response(http::header<false> const& res,
|
||||
return false;
|
||||
if(res.count(http::field::sec_websocket_accept) != 1)
|
||||
return false;
|
||||
detail::sec_ws_accept_type accept;
|
||||
detail::make_sec_ws_accept(accept, key);
|
||||
if(accept.compare(
|
||||
detail::sec_ws_accept_type acc;
|
||||
detail::make_sec_ws_accept(acc, key);
|
||||
if(acc.compare(
|
||||
res[http::field::sec_websocket_accept]) != 0)
|
||||
return false;
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user