Created
September 26, 2011 07:35
-
-
Save ryo1kato/1241794 to your computer and use it in GitHub Desktop.
allow special chars to be used in proxy-auth for Cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ diff -u ./Distribution/Client/HttpUtils.hs.orig ./Distribution/Client/HttpUtils.hs | |
--- ./Distribution/Client/HttpUtils.hs.orig 2011-09-26 15:59:04.368889933 +0900 | |
+++ ./Distribution/Client/HttpUtils.hs 2011-09-26 16:31:17.142379016 +0900 | |
@@ -12,6 +12,7 @@ | |
import Network.HTTP | |
( Request (..), Response (..), RequestMethod (..) | |
, Header(..), HeaderName(..) ) | |
+import qualified Network.HTTP.Base | |
import Network.URI | |
( URI (..), URIAuth (..), parseAbsoluteURI ) | |
import Network.Stream | |
@@ -129,6 +130,7 @@ | |
'@':s' -> reverse s' | |
_ -> s | |
} | |
+ | |
uri2proxy :: URI -> Maybe Proxy | |
uri2proxy uri@URI{ uriScheme = "http:" | |
, uriAuthority = Just (URIAuth auth' host port) | |
@@ -137,9 +139,10 @@ | |
then Nothing | |
else Just (AuthBasic "" usr pwd uri) | |
(usr,pwd') = break (==':') auth' | |
- pwd = case pwd' of | |
+ pwd'' = case pwd' of | |
':':cs -> cs | |
_ -> pwd' | |
+ pwd = Network.HTTP.Base.urlDecode pwd'' | |
uri2proxy _ = Nothing | |
mkRequest :: URI -> Request ByteString |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment