From ba710bee8674fb880da0229777ab0cda4ac8110f Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 12 Feb 2015 09:21:07 -0800 Subject: [PATCH] Reject invalid requests on peer port sooner. --- src/ripple/server/impl/ServerHandlerImp.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ripple/server/impl/ServerHandlerImp.cpp b/src/ripple/server/impl/ServerHandlerImp.cpp index 2fa74bb59..07af7bd49 100644 --- a/src/ripple/server/impl/ServerHandlerImp.cpp +++ b/src/ripple/server/impl/ServerHandlerImp.cpp @@ -184,6 +184,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)))