From 5cff3cd10e7b4a830fa76c788c21ba5bd71102de Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 23 Jan 2013 16:48:58 -0800 Subject: [PATCH] Rollback a change. --- src/cpp/websocketpp/src/roles/server.hpp | 44 +++++++++++++++++------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/src/cpp/websocketpp/src/roles/server.hpp b/src/cpp/websocketpp/src/roles/server.hpp index 754f4f6b6..48b4906b0 100644 --- a/src/cpp/websocketpp/src/roles/server.hpp +++ b/src/cpp/websocketpp/src/roles/server.hpp @@ -539,18 +539,36 @@ void server::connection::async_init() { // TODO: make this value configurable m_connection.register_timeout(5000,fail::status::TIMEOUT_WS, "Timeout on WebSocket handshake"); - - boost::asio::async_read_until( - m_connection.get_socket(), - 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 - )) - ); + + 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 + )) + ); + } } /// processes the response from an async read for an HTTP header @@ -822,7 +840,7 @@ void server::connection::write_response() { m_endpoint.m_alog->at(log::alevel::DEBUG_HANDSHAKE) << raw << log::endl; - boost::asio::async_write( + boost::asio::async_write( // FIXME m_connection.get_socket(), //boost::asio::buffer(raw), buffer,