summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assistant/Threads/WebApp.hs18
-rw-r--r--Utility/WebApp.hs6
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/assistant_listens_on_127.0.0.1_not_::1_which_breaks_IPv6_enabled_hosts.mdwn3
4 files changed, 18 insertions, 12 deletions
diff --git a/Assistant/Threads/WebApp.hs b/Assistant/Threads/WebApp.hs
index 5ac36f698..c4c9fa87a 100644
--- a/Assistant/Threads/WebApp.hs
+++ b/Assistant/Threads/WebApp.hs
@@ -35,7 +35,7 @@ import Git
import Yesod
import Yesod.Static
-import Network.Socket (PortNumber)
+import Network.Socket (SockAddr)
import Data.Text (pack, unpack)
thisThread :: String
@@ -67,14 +67,14 @@ webAppThread assistantdata urlrenderer noannex postfirstrun onstartup = thread $
( return $ httpDebugLogger app
, return app
)
- runWebApp app' $ \port -> if noannex
+ runWebApp app' $ \addr -> if noannex
then withTempFile "webapp.html" $ \tmpfile _ ->
- go port webapp tmpfile Nothing
+ go addr webapp tmpfile Nothing
else do
let st = threadState assistantdata
htmlshim <- runThreadState st $ fromRepo gitAnnexHtmlShim
urlfile <- runThreadState st $ fromRepo gitAnnexUrlFile
- go port webapp htmlshim (Just urlfile)
+ go addr webapp htmlshim (Just urlfile)
where
thread = NamedThread thisThread
getreldir
@@ -82,13 +82,13 @@ webAppThread assistantdata urlrenderer noannex postfirstrun onstartup = thread $
| otherwise = Just <$>
(relHome =<< absPath
=<< runThreadState (threadState assistantdata) (fromRepo repoPath))
- go port webapp htmlshim urlfile = do
- let url = myUrl webapp port
+ go addr webapp htmlshim urlfile = do
+ let url = myUrl webapp addr
maybe noop (`writeFileProtected` url) urlfile
writeHtmlShim "Starting webapp..." url htmlshim
maybe noop (\a -> a url htmlshim) onstartup
-myUrl :: WebApp -> PortNumber -> Url
-myUrl webapp port = unpack $ yesodRender webapp urlbase HomeR []
+myUrl :: WebApp -> SockAddr -> Url
+myUrl webapp addr = unpack $ yesodRender webapp urlbase HomeR []
where
- urlbase = pack $ "http://localhost:" ++ show port
+ urlbase = pack $ "http://" ++ show addr
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.
-
diff --git a/debian/changelog b/debian/changelog
index eceb47493..2df17e2bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ git-annex (3.20130108) UNRELEASED; urgency=low
* drop: Suggest using git annex move when numcopies prevents dropping a file.
* webapp: Repo switcher filters out repos that do not exist any more
(or are on a drive that's not mounted).
+ * 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.
-- Joey Hess <joeyh@debian.org> Tue, 08 Jan 2013 12:37:38 -0400
diff --git a/doc/bugs/assistant_listens_on_127.0.0.1_not_::1_which_breaks_IPv6_enabled_hosts.mdwn b/doc/bugs/assistant_listens_on_127.0.0.1_not_::1_which_breaks_IPv6_enabled_hosts.mdwn
index c1e84a760..90034f7f5 100644
--- a/doc/bugs/assistant_listens_on_127.0.0.1_not_::1_which_breaks_IPv6_enabled_hosts.mdwn
+++ b/doc/bugs/assistant_listens_on_127.0.0.1_not_::1_which_breaks_IPv6_enabled_hosts.mdwn
@@ -25,3 +25,6 @@ I've tested this with:
* chromium
Iceweasel is the only one which correctly fell back to IPv4 and worked.
+
+> Ok, I've made it use the IP address in the URL. Ugly, but avoids
+> whatever mess results in this behavior. [[done]] --[[Joey]]