Dear lazy programmers, I was surprised to discover that `cabal-install' -- a popular utility for installing Hackage packages -- cannot work with HTTP proxies. Despite all the necessary code linked in.
`cabal update' command returns HTTP 407 (Proxy Authentication Required) error. The problem is explained below and patches follow. * * * Our office LAN has an HTTP proxy server with authorization. And my shell environment has a variable like http_proxy='http://user:passw...@proxyhost:proxyport/' tcpdump-ing shows that `cabal update' sends invalid credentials in HTTP "CONNECT" request. The proper string would be "user:password" (base64-encoded) while `cabal' sends "user:password@". There's no surprise proxy server denies connection! I've traced the problem down to `userinfo' function, defined in network-2.2.0.1/Network/URI.hs:451: > -- RFC3986, section 3.2.1 > > userinfo :: URIParser String > userinfo = > do { uu <- many (uchar ";:&=+$,") > ; char '@' > ; return (concat uu ++"@") > } Let us see section 3.2 of RFC3986: > authority = [ userinfo "@" ] host [ ":" port ] > [... > ...] The user information, if present, is followed by a > commercial at-sign ("@") that delimits it from the host. There is no reason for "@" character to be a part of `userinfo' expression. * * * So, the Right Way(TM) to make cabal-install go through proxies is fixing `userinfo' function of `network' package (see the `network-2.2.0.1.patch'). Until then, we should have a workaround in `cabal-install' (cabal-install-0.6.0.patch). I do. Happy hacking! -- vvv
network-2.2.0.1.patch
Description: Binary data
cabal-install-0.6.0.patch
Description: Binary data
_______________________________________________ cabal-devel mailing list cabal-devel@haskell.org http://www.haskell.org/mailman/listinfo/cabal-devel