Network.HTTP user error resolution '(https not supported)'

When starting this Haskell program with runghc:

import Network.HTTP

main = simpleHTTP (getRequest "https://stackoverflow.com")
       >>= getResponseBody >>= putStrLn

I get an error

printso.hs: user error (https not supported)

I don't want to switch to plaintext HTTP - how can I use Network.HTTPwith SSL / TLS?

+4
source share
1 answer

You cannot do this directly, see for example this post . However, you can use Network.HTTP.Conduitfrom the library http-conduit.

First install it with cabal install http-conduit.

Then you can use this code (note that it contrasts with Network.HTTPuses lazy ByteStrings) as a replacement:

import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy as LB

main = simpleHttp "https://stackoverflow.com"
       >>= LB.putStr

libcurl Haskell, libcurl, .

+5

All Articles