From 91ebff5793573ddcfbd40ca13f8c900e8b41ab32 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 31 Mar 2020 13:17:45 -0700 Subject: Fix guardIP and some other cleanup Apparently guardIP wasn't working because it wasn't matching on the right string, *and* I had typo'ed my IP address. I took this opportunity to also organize the Scotty code a bit better with some comments. --- Run/Que/Server.hs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'Run/Que') diff --git a/Run/Que/Server.hs b/Run/Que/Server.hs index 1acbe60..fe88014 100644 --- a/Run/Que/Server.hs +++ b/Run/Que/Server.hs @@ -20,7 +20,6 @@ import qualified Com.Simatime.Go as Go import qualified Control.Concurrent.STM as STM import qualified Control.Exception as Exception import Control.Monad.Reader ( MonadTrans ) -import qualified Data.ByteString as BS import qualified Data.ByteString.Builder.Extra as Builder import qualified Data.ByteString.Lazy as BSL import Data.HashMap.Lazy ( HashMap ) @@ -75,15 +74,17 @@ guardIP r = case Wai.remoteHost r of Socket.SockAddrInet _ ip | ip `elem` allowed -> Scotty.status Http.ok200 _ -> Scotty.status Http.methodNotAllowed405 where - allowed = Socket.tupleToHostAddress