psibi / download

High level download interface for Haskell
https://www.stackage.org/package/download
Other
10 stars 3 forks source link

Failed to connect: Network is unreachable #12

Open regellosigkeitsaxiom opened 7 years ago

regellosigkeitsaxiom commented 7 years ago

I am clearly connected to the internet, but:

*Main> openURI "http://haskell.org"
Left "Failed to connect: Network is unreachable"

What details about my connection might be useful? Or it is not just me?

psibi commented 7 years ago

Basically, this package doesn't support https. I think http://haskell.org redirects to https://haskell.org and it fails then. I agree there should be a better description message.

As a test, does this URL work: http://google.com ?

regellosigkeitsaxiom commented 7 years ago

Yes, http://google.com works. Error reproduces on many websites which should be plain HTTP. On one of my websites with forced https error is Left "Failed to connect: Success". Will research more.

psibi commented 7 years ago

Yeah, HTTPS is not supported by the underlying C library which is used by this haskell package. I have been planning to replace the C library with a more modern one (which supports HTTPS, etc) once I get time.

In fact you can use wget to see why it doesn't work for haskell.org:

@sibi::jane { ~ }-> wget http://haskell.org
--2017-01-09 01:01:46--  http://haskell.org/
Resolving haskell.org (haskell.org)... 23.253.242.70, 2001:4800:7817:104:be76:4eff:fe04:f608
Connecting to haskell.org (haskell.org)|23.253.242.70|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.haskell.org/ [following]
--2017-01-09 01:01:46--  http://www.haskell.org/
Resolving www.haskell.org (www.haskell.org)... 162.242.239.16, 2001:4802:7802:102:be76:4eff:fe20:9d4a
Connecting to www.haskell.org (www.haskell.org)|162.242.239.16|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://www.haskell.org/ [following]
--2017-01-09 01:01:47--  https://www.haskell.org/
Connecting to www.haskell.org (www.haskell.org)|162.242.239.16|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 36021 (35K) [text/html]
Saving to: ‘index.html’

You can see that there is a redirection happening to https and hence it is failing.