Updates on_http and validate handlers to use new handler interface

This commit is contained in:
Peter Thorson
2013-01-07 17:14:29 -06:00
parent e7b87e5d54
commit 8df37fffbc
4 changed files with 45 additions and 4 deletions

View File

@@ -762,7 +762,9 @@ bool connection<config>::process_handshake_request() {
// this is not a websocket handshake. Process as plain HTTP
std::cout << "HTTP REQUEST" << std::endl;
m_handler->http(type::shared_from_this());
if (m_http_handler) {
m_http_handler(m_connection_hdl);
}
return true;
}
@@ -809,7 +811,7 @@ bool connection<config>::process_handshake_request() {
}
// Ask application to validate the connection
if (m_handler->validate(type::shared_from_this())) {
if (!m_validate_handler || m_validate_handler(m_connection_hdl)) {
m_response.set_status(http::status_code::SWITCHING_PROTOCOLS);
// Write the appropriate response headers based on request and

View File

@@ -65,6 +65,8 @@ endpoint<connection,config>::create_connection() {
con->set_pong_handler(m_pong_handler);
con->set_pong_timeout_handler(m_pong_timeout_handler);
con->set_interrupt_handler(m_interrupt_handler);
con->set_http_handler(m_http_handler);
con->set_validate_handler(m_validate_handler);
con->set_termination_handler(
lib::bind(