Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/53d23ede38c8fbe64be9a543b56297babbe38d62

>---------------------------------------------------------------

commit 53d23ede38c8fbe64be9a543b56297babbe38d62
Author: Duncan Coutts <[email protected]>
Date:   Thu Dec 18 16:55:41 2008 +0000

    Workaround for a url parsing bug that breaks http proxies that need auth
    Diagnosis and patch from Valery V. Vorotyntsev.

>---------------------------------------------------------------

 cabal-install/Distribution/Client/HttpUtils.hs |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/cabal-install/Distribution/Client/HttpUtils.hs 
b/cabal-install/Distribution/Client/HttpUtils.hs
index ac9aafc..fb97b1a 100644
--- a/cabal-install/Distribution/Client/HttpUtils.hs
+++ b/cabal-install/Distribution/Client/HttpUtils.hs
@@ -101,9 +101,17 @@ parseHttpProxy str = join
   where
     parseHttpURI str' = case parseAbsoluteURI str' of
       Just uri@URI { uriAuthority = Just _ }
-         -> Just uri
+         -> Just (fixUserInfo uri)
       _  -> Nothing
 
+fixUserInfo :: URI -> URI
+fixUserInfo uri = uri{ uriAuthority = f `fmap` uriAuthority uri }
+    where
+      f a@URIAuth{ uriUserInfo = s } =
+          a{ uriUserInfo = case reverse s of
+                             '@':s' -> reverse s'
+                             _      -> s
+           }
 uri2proxy :: URI -> Maybe Proxy
 uri2proxy uri@URI{ uriScheme = "http:"
                  , uriAuthority = Just (URIAuth auth' host port)



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to