diff options
author | Joey Hess <joey@kitenet.net> | 2013-01-09 23:17:52 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-01-09 23:18:00 -0400 |
commit | b806e8e4d10c428025e23ce501b14380b821735d (patch) | |
tree | 3851a9ca29767bad122149a9acc86d2aac51061f /Utility/WebApp.hs | |
parent | 6a46afb5a7280e70ace7487019c710a579657d80 (diff) |
webapp: Use IP address, rather than localhost
since some systems may have configuration problems or other issues that
prevent web browsers from connecting to the right localhost IP for the
webapp.
Tested on both ipv4 and ipv6 localhost. Url for the latter looks like:
http://[::1]:50676
Diffstat (limited to 'Utility/WebApp.hs')
-rw-r--r-- | Utility/WebApp.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index d3bd523a8..51300c9cf 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -54,14 +54,14 @@ runBrowser url env = boolSystemEnv cmd [Param url] env {- Binds to a socket on localhost, and runs a webapp on it. - - - An IO action can also be run, to do something with the port number, + - An IO action can also be run, to do something with the address, - such as start a web browser to view the webapp. -} -runWebApp :: Wai.Application -> (PortNumber -> IO ()) -> IO () +runWebApp :: Wai.Application -> (SockAddr -> IO ()) -> IO () runWebApp app observer = do sock <- localSocket void $ forkIO $ runSettingsSocket defaultSettings sock app - observer =<< socketPort sock + observer =<< getSocketName sock {- Binds to a local socket, selecting any free port. - |