summaryrefslogtreecommitdiffhomepage
path: root/SessionID.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-30 11:53:10 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-30 12:15:47 -0400
commit9331a37b178c9142f5e864bbdc5434ea208946cc (patch)
tree6431bc6cd3f09f8c64a51c780f7d549c3a6832ab /SessionID.hs
parent5ddda2f7684857e90f45c37d030858773e96ee99 (diff)
downloaddebug-me-9331a37b178c9142f5e864bbdc5434ea208946cc.tar.gz
make url work without --debug
Diffstat (limited to 'SessionID.hs')
-rw-r--r--SessionID.hs10
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