Reject invalid requests on peer port sooner.

This commit is contained in:
Vinnie Falco
2015-02-12 09:21:07 -08:00
committed by Tom Ritchford
parent 33175187b7
commit 982dc6aa8c

View File

@@ -191,6 +191,15 @@ void runCoroutine (RPC::Coroutine coroutine, JobQueue& jobQueue)
void
ServerHandlerImp::onRequest (HTTP::Session& session)
{
// Make sure RPC is enabled on the port
if (session.port().protocol.count("http") == 0 &&
session.port().protocol.count("https") == 0)
{
HTTPReply (403, "Forbidden", makeOutput (session));
session.close (true);
return;
}
// Check user/password authorization
if (! authorized (session.port(),
build_map(session.request().headers)))