From 0c97dda2765345ea27cefd5e0dbb2cf193dd7ab0 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 28 Feb 2017 12:27:02 -0800 Subject: [PATCH] Make "wss" work the same as "wss2" --- src/ripple/rpc/impl/ServerHandlerImp.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index 2f9ccca83..81f5d62e4 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -185,9 +185,13 @@ ServerHandlerImp::onHandoff (Session& session, boost::asio::ip::tcp::endpoint remote_address) -> Handoff { + const bool is_ws = + (session.port().protocol.count("wss") > 0) || + (session.port().protocol.count("wss2") > 0); + if(isWebsocketUpgrade(request)) { - if(session.port().protocol.count("wss2") > 0) + if(is_ws) { Handoff handoff; auto const ws = session.websocketUpgrade(); @@ -202,9 +206,6 @@ ServerHandlerImp::onHandoff (Session& session, return handoff; } - if(session.port().protocol.count("wss") > 0) - return {}; // Pass to websocket - return unauthorizedResponse(request); } @@ -214,7 +215,7 @@ ServerHandlerImp::onHandoff (Session& session, std::move(request), remote_address); } - if (session.port().protocol.count("wss2") > 0 && isStatusRequest(request)) + if (is_ws && isStatusRequest(request)) return statusResponse(request); // Pass to legacy onRequest