Search code examples
cabal-install

Cabal fails with proxy with authentication


This is a well-known bug that cabal can not handle proxies in format http://user:password@host:port format. On Haskell mailing list, someone suggested a patch to overcome this but that patch is now quite old.

It fails with following message

   Downloading the latest package list from hackage.haskell.org
   Warning: invalid http proxy uri:
   "http://user:pass@host:80/"
   Warning: proxy uri must be http with a hostname
   Warning: ignoring http proxy, trying a direct connection

Does anyone know how to make cabal use my proxy settings? Any indirect method will also do such as proxy bypassing etc.

A similar question is asked on superuser but it is not answered there.


Solution

  • I have got it working with polipo. My university uses http-proxy with authentication. In /etc/polipo/config you need to add these lines

    parentProxy = "proxy.server.com:80"
    parentAuthCredentials = "myusername:mypassword"
    

    And export http_proxy=http://localhost:8123". And it worked like a charm.