diff options
Diffstat (limited to 'SessionID.hs')
-rw-r--r-- | SessionID.hs | 10 |
1 files changed, 6 insertions, 4 deletions
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 |