From 9331a37b178c9142f5e864bbdc5434ea208946cc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 30 Apr 2017 11:53:10 -0400 Subject: make url work without --debug --- SessionID.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'SessionID.hs') diff --git a/SessionID.hs b/SessionID.hs index c526849..170c0e5 100644 --- a/SessionID.hs +++ b/SessionID.hs @@ -15,8 +15,10 @@ import System.IO import System.Directory import Network.Wai.Handler.Warp (Port) import Data.List +import Data.Maybe import Data.UUID import Data.UUID.V4 +import Network.URI import Control.Concurrent.STM import Control.Exception @@ -72,7 +74,7 @@ withSessionID dir a = do cleanup hv = hClose =<< atomically (readTVar hv) go sid hv = a (hv, sid) -type UrlString = String - -sessionIDUrl :: SessionID -> String -> Port -> UrlString -sessionIDUrl (SessionID f) host port = "http://" ++ host ++ ":" ++ show port ++ "/" ++ f +sessionIDUrl :: SessionID -> String -> Port -> URI +sessionIDUrl (SessionID f) host port = + fromMaybe (error "internal url parse failure") $ parseURI $ + "http://" ++ host ++ ":" ++ show port ++ "/" ++ f -- cgit v1.2.3