0

I am trying to install cabal behind a firewall without success. It seems that cabal does not support http redirect, is there a way to fix it?

cabal update -v3


Downloading the latest package list from hackage.haskell.org
Sending:
GET http://hackage.haskell.org/packages/archive/00-index.tar.gz HTTP/1.1
User-Agent: cabal-install/1.20.0.2 (linux; x86_64)
Host: hackage.haskell.org

proxy uri host: proxy.swmed.edu, port: :3128
Creating new connection to proxy.swmed.edu:3128
Received:
HTTP/1.1 302 authenticationrequired
Via: 1.1 129.112.115.40 (McAfee Web Gateway 7.4.2.1.0.17593)
Date: Fri, 20 Jun 2014 17:00:56 GMT
Location:
https://m-proxy1.swmed.edu:10000/mwg-internal/de5fs23hu73ds/plugin?target=Auth&reason=Auth&ClientID=2152648114&ttl=43200&url=aHR0cDovL2hhY2thZ2UuaGFza2VsbC5vcmcvcGFja2FnZXMvYXJjaGl2ZS8wMC1pbmRleC50YXIuZ3o=&rnd=1403283656
Content-Type: text/html
Cache-Control: no-cache
Content-Length: 3678
Proxy-Connection: Keep-Alive

302 - redirect
Warning: http error: Unable to handle redirect, unsupported scheme:
https://m-proxy1.swmed.edu:10000/mwg-internal/de5fs23hu73ds/plugin?target=Auth&reason=Auth&ClientID=2152648114&ttl=43200&url=aHR0cDovL2hhY2thZ2UuaGFza2VsbC5vcmcvcGFja2FnZXMvYXJjaGl2ZS8wMC1pbmRleC50YXIuZ3o=&rnd=1403283656
cabal: Failed to download
http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc "Error
HTTP code: 302"

(Update) Jun 23, 2014

Follow @Sibi suggestion, I pasted a similar experience using cntlm-0.92.3. Here is my config config.ini:

Proxy               proxy.swmed.edu:3128
Listen  127.0.0.1:53124

I first tried to use:

./cntlm -c config.ini

then the same error happens:

cabal update -v3
Downloading the latest package list from hackage.haskell.org
Sending:
GET http://hackage.haskell.org/packages/archive/00-index.tar.gz HTTP/1.1
User-Agent: cabal-install/1.20.0.2 (linux; x86_64)
Host: hackage.haskell.org

proxy uri host: 127.0.0.1, port: :53124
Creating new connection to 127.0.0.1:53124
Received:
HTTP/1.1 302 authenticationrequired
Via: 1.1 129.112.115.43 (McAfee Web Gateway 7.4.2.1.0.17593)
Date: Mon, 23 Jun 2014 05:34:18 GMT
Location:
https://m-proxy4.swmed.edu:10000/mwg-internal/de5fs23hu73ds/plugin?target=Auth&reason=Auth&ClientID=1513153200&ttl=43200&url=aHR0cDovL2hhY2thZ2UuaGFza2VsbC5vcmcvcGFja2FnZXMvYXJjaGl2ZS8wMC1pbmRleC50YXIuZ3o=&rnd=1403501658
Content-Type: text/html
Cache-Control: no-cache
Content-Length: 3678
Proxy-Connection: Keep-Alive
Connection: close

302 - redirect
Warning: http error: Unable to handle redirect, unsupported scheme:
https://m-proxy4.swmed.edu:10000/mwg-internal/de5fs23hu73ds/plugin?target=Auth&reason=Auth&ClientID=1513153200&ttl=43200&url=aHR0cDovL2hhY2thZ2UuaGFza2VsbC5vcmcvcGFja2FnZXMvYXJjaGl2ZS8wMC1pbmRleC50YXIuZ3o=&rnd=1403501658
cabal: Failed to download
http://hackage.haskell.org/packages/archive/00-index.tar.gz : ErrorMisc "Error
HTTP code: 302"

NOTE: this question is not the same as authentication, as our proxy server does not need to be authenticated. This question is about http redirect problem.

(Update) June 23, 2014

Run the following command as @Sibi suggested:

./cntlm -M http://www.google.com -c config.ini -v

And the output can be found at http://pastebin.com/zAvZBDVu

zhanxw
  • 3,159
  • 3
  • 34
  • 32
  • It seems your proxy needs authentication, one way to do that would be using `cntlm` to configure it. – Sibi Jun 20 '14 at 17:06
  • Possible duplicate of http://stackoverflow.com/questions/9310218/cabal-fails-with-proxy-with-authentication – mhwombat Jun 20 '14 at 18:03
  • @Sibi, I have tried `cntlm` but got the same error. @mhwombat, I have looked up your link. That link is about authentication of proxy, but my problem is how to handle HTTP redirect. – zhanxw Jun 21 '14 at 17:54
  • @zhanxw Can you updated the question with what exactly you tried with `cntlm` and what new error you are getting ? – Sibi Jun 21 '14 at 18:49
  • @Sibi I have updated my question as you suggested. Thanks. – zhanxw Jun 23 '14 at 05:40
  • @zhanxw What is the output of `cntlm -M http://www.google.com` ? – Sibi Jun 23 '14 at 07:46
  • @Sibi my university proxy does not requires authentication. I have also update the post to include the `cntlm -M http://www.google.com`. – zhanxw Jun 23 '14 at 17:19
  • @zhanxw There is no need to put `-c config.ini -v` after that command. What is the output you are getting once you enter that command ? Also, after installing `cntlm`, you should configure `/etc/cntlm.conf` properly. If your universtiy doesn't require authentication, then why does the `cabal` error message says that it requires authentication. – Sibi Jun 23 '14 at 17:25
  • @zhanxw Did you set the environmental variable `http_proxy` and `https_proxy` to `127.0.0.1:53124` ? – Sibi Jun 23 '14 at 17:45
  • @Sibi the command line outputs are in the original questions, and it has the same warning message `Warning: http error: Unable to handle redirect, unsupported scheme`. (1) I have set `http_proxy` and `https_proxy`, since `cabel` tried to connect to `127.0.0.1:53124`; (2) The `cabal` error messages mentioned authentication, but these is confusing to me; (3) The last two lins at http://pastebin.com/zAvZBDVu says "Your proxy is open, you don't need another proxy. cntlm: Terminating with 0 active threads". I guess wether to use `cntlm` or not does not make differences here. Thanks for your hints. – zhanxw Jun 23 '14 at 22:06
  • @zhanxw The authentication part is confusing me also. The message `Your proxy is open` indicates that another cntlm process (the standard daemon) has successfully authenticated with your proxy. I'm not sure what to do in this case. Just out of curiosity, what version of `cabal` you are using ? You may try to update to the latest version in case you haven't done it already (but that needs connection to the internet!) – Sibi Jun 24 '14 at 08:15
  • @Sibi I have made sure there is only one cntlm process but the problem remains. The `cabal` version is `cabal-install version 1.20.0.2 using version 1.20.0.0 of the Cabal library`. I am now thinking a Haskell library causes the problem as it cannot handle HTTP redirect request. – zhanxw Jul 01 '14 at 14:53
  • @zhanxw Sounds like a bug to me, why don't you report it in the github issues. – Sibi Jul 01 '14 at 18:34
  • I don't know Haskell right now, so I cannot give the Haskell community a minimal example. I will have to wait till newer versions come. – zhanxw Jul 02 '14 at 02:40

1 Answers1

0

Reading the logs, we see the proxy was via https not http, and the error was "unsupported scheme" since cabal prior to recent versions did not handle https. Https transports have been added to cabal in the most recent versions, so the issue should now be resolved.

sclv
  • 38,665
  • 7
  • 99
  • 204