Skip to content

Instantly share code, notes, and snippets.

@ryo1kato
Created September 26, 2011 07:35
Show Gist options
  • Save ryo1kato/1241794 to your computer and use it in GitHub Desktop.
Save ryo1kato/1241794 to your computer and use it in GitHub Desktop.
allow special chars to be used in proxy-auth for Cabal
$ 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