cabal-install sends invalid proxy password
Valery V. Vorotyntsev
valery.vv at gmail.com
Fri Dec 12 09:05:45 EST 2008
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:password@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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: network-2.2.0.1.patch
Type: application/octet-stream
Size: 1598 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/cabal-devel/attachments/20081212/6ca19fe0/network-2.2.0.1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cabal-install-0.6.0.patch
Type: application/octet-stream
Size: 799 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/cabal-devel/attachments/20081212/6ca19fe0/cabal-install-0.6.0.obj
More information about the cabal-devel
mailing list