mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Rollback.
This commit is contained in:
@@ -53,32 +53,6 @@
|
||||
|
||||
namespace websocketpp {
|
||||
|
||||
typedef boost::asio::buffers_iterator<boost::asio::streambuf::const_buffers_type> bufIterator;
|
||||
|
||||
static std::pair<bufIterator, bool> match_header(bufIterator begin, bufIterator end)
|
||||
{
|
||||
// Do we have a complete HTTP request
|
||||
const std::string header_match = "\r\n\r\n";
|
||||
bufIterator it = std::search(begin, end, header_match.begin(), header_match.end());
|
||||
if (it != end)
|
||||
return std::make_pair(it, true);
|
||||
|
||||
// If we don't have a flash policy request, we're done
|
||||
const std::string flash_match = "<policy-file-request/>";
|
||||
it = std::search(begin, end, flash_match.begin(), flash_match.end());
|
||||
if (it == end)
|
||||
return std::make_pair(end, false);
|
||||
|
||||
// If we have a line ending before the flash policy request, treat as http
|
||||
const std::string eol_match = "\r\n";
|
||||
bufIterator it2 = std::search(begin, end, eol_match.begin(), eol_match.end());
|
||||
if ((it2 != end) || (it < it2))
|
||||
return std::make_pair(end, false);
|
||||
|
||||
// Treat as flash policy request
|
||||
return std::make_pair(it, true);
|
||||
}
|
||||
|
||||
// Forward declarations
|
||||
template <typename T> struct endpoint_traits;
|
||||
|
||||
@@ -539,36 +513,18 @@ void server<endpoint>::connection<connection_type>::async_init() {
|
||||
// TODO: make this value configurable
|
||||
m_connection.register_timeout(5000,fail::status::TIMEOUT_WS,
|
||||
"Timeout on WebSocket handshake");
|
||||
|
||||
if (m_connection.isSecure())
|
||||
{
|
||||
boost::asio::async_read_until(
|
||||
m_connection.SSLSocket(),
|
||||
m_connection.buffer(),
|
||||
// match_header,
|
||||
"\r\n\r\n",
|
||||
m_connection.get_strand().wrap(boost::bind(
|
||||
&type::handle_read_request,
|
||||
m_connection.shared_from_this(),
|
||||
boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred
|
||||
))
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
boost::asio::async_read_until(
|
||||
m_connection.PlainSocket(),
|
||||
m_connection.buffer(),
|
||||
match_header,
|
||||
m_connection.get_strand().wrap(boost::bind(
|
||||
&type::handle_read_request,
|
||||
m_connection.shared_from_this(),
|
||||
boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
boost::asio::async_read_until(
|
||||
m_connection.get_socket(),
|
||||
m_connection.buffer(),
|
||||
"\r\n\r\n",
|
||||
m_connection.get_strand().wrap(boost::bind(
|
||||
&type::handle_read_request,
|
||||
m_connection.shared_from_this(),
|
||||
boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred
|
||||
))
|
||||
);
|
||||
}
|
||||
|
||||
/// processes the response from an async read for an HTTP header
|
||||
@@ -840,7 +796,7 @@ void server<endpoint>::connection<connection_type>::write_response() {
|
||||
|
||||
m_endpoint.m_alog->at(log::alevel::DEBUG_HANDSHAKE) << raw << log::endl;
|
||||
|
||||
boost::asio::async_write( // FIXME
|
||||
boost::asio::async_write(
|
||||
m_connection.get_socket(),
|
||||
//boost::asio::buffer(raw),
|
||||
buffer,
|
||||
|
||||
Reference in New Issue
Block a user