summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-28 22:53:26 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-28 22:53:26 -0400
commit869e2f68904915a29ade7438033ad2b253fbee26 (patch)
treebec5c1d73531b5e3721f28d8c86b0fe31f02222e /Utility
parentd45ea6098b3fc0d8c98a7e7984f637655b637322 (diff)
remove buggy --listen=host:port support
Diffstat (limited to 'Utility')
-rw-r--r--Utility/WebApp.hs16
1 files changed, 2 insertions, 14 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs
index 9d0751502..c9cb32106 100644
--- a/Utility/WebApp.hs
+++ b/Utility/WebApp.hs
@@ -115,13 +115,13 @@ getSocket h = do
use sock
where
#else
- addrs <- getAddrInfo (Just hints) (Just hostname) port
+ addrs <- getAddrInfo (Just hints) (Just hostname) Nothing
case (partition (\a -> addrFamily a == AF_INET) addrs) of
(v4addr:_, _) -> go v4addr
(_, v6addr:_) -> go v6addr
_ -> error "unable to bind to a local socket"
where
- (hostname, port) = maybe (localhost, Nothing) splitHostPort h
+ hostname = fromMaybe localhost h
hints = defaultHints { addrSocketType = Stream }
{- Repeated attempts because bind sometimes fails for an
- unknown reason on OSX. -}
@@ -142,18 +142,6 @@ getSocket h = do
listen sock maxListenQueue
return sock
-{- Splits address:port. For IPv6, use [address]:port. The port is optional. -}
-splitHostPort :: String -> (HostName, Maybe ServiceName)
-splitHostPort s
- | "[" `isPrefixOf` s = let (h, p) = break (== ']') (drop 1 s)
- in if "]:" `isPrefixOf` p
- then (h, Just $ drop 2 p)
- else (h, Nothing)
- | otherwise = let (h, p) = separate (== ':') s
- in if null p
- then (h, Nothing)
- else (h, Just p)
-
{- Checks if debugging is actually enabled. -}
debugEnabled :: IO Bool
debugEnabled = do