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 }
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))); }