Safe Haskell | None |
---|---|
Language | Haskell2010 |
Make HTTPS connections using http-client and Rustls.
>>>
import qualified Rustls
>>>
import qualified Network.HTTP.Client as HTTP
>>>
:{
newRustlsManager :: IO HTTP.Manager newRustlsManager = do clientConfig <- Rustls.buildClientConfig $ Rustls.defaultClientConfigBuilder roots HTTP.newManager $ rustlsManagerSettings clientConfig where -- For now, rustls-ffi does not provide a built-in way to access -- the OS certificate store. roots = Rustls.ClientRootsFromFile "/etc/ssl/certs/ca-certificates.crt">>>
:}
>>>
:{
example = do mgr <- newRustlsManager -- this should be shared across multiple requests req <- HTTP.parseUrlThrow "https://example.org" res <- HTTP.httpLbs req mgr print $ HTTP.responseBody res :}
Synopsis
Documentation
rustlsManagerSettings :: ClientConfig -> ManagerSettings Source #
Get TLS-enabled HTTP ManagerSettings
from a Rustls
ClientConfig
, consumable via newManager
.