void processSession (Job& job, HTTP::Session& session) { session.write (m_deprecatedHandler.processRequest ( session.content(), session.remoteAddress().withPort(0).to_string())); session.close(); }
void onAccept (HTTP::Session& session) { // Reject non-loopback connections if RPC_ALLOW_REMOTE is not set if (! getConfig().RPC_ALLOW_REMOTE && ! session.remoteAddress().isLoopback()) { session.close(); } }
void ServerHandlerImp::onAccept (HTTP::Session& session) { // Reject non-loopback connections if RPC_ALLOW_REMOTE is not set if (! setup_.allow_remote && ! beast::IP::is_loopback (session.remoteAddress())) { session.close (false); } }
void ServerHandlerImp::onRequest (HTTP::Session& session) { // Check user/password authorization auto const headers (build_map (session.message().headers)); if (! HTTPAuthorized (headers)) { session.write (HTTPReply (403, "Forbidden")); session.close (true); return; } session.detach(); m_jobQueue.addJob (jtCLIENT, "RPC-Client", std::bind ( &ServerHandlerImp::processSession, this, std::placeholders::_1, std::ref (session))); }
void onRequest (HTTP::Session& session) { #if 0 Job job; processSession (job, session); #else session.detach(); // The "boost::"'s are a workaround for broken versions of tr1::functional that // require the reference wrapper to be callable. HTTP::Session has abstract functions // and so references to it are not callable. m_jobQueue.addJob (jtRPC, "RPC", boost::bind ( &RPCHTTPServerImp::processSession, this, boost::_1, boost::ref (session))); #endif }
// Dispatched on the job queue void ServerHandlerImp::processSession (Job& job, HTTP::Session& session) { auto const s (to_string(session.message().body)); session.write (processRequest (to_string(session.message().body), session.remoteAddress().at_port(0))); if (session.message().keep_alive()) { session.complete(); } else { session.close (true); } }