graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Client.Restricted

Description

Restricted ManagerSettings for https://haskell-lang.org/library/http-client - - Portions from http-client-tls Copyright (c) 2013 Michael Snoyman - Portions from http-client-restricted Copyright 2018 Joey Hess id@joeyh.name - - License: MIT

Synopsis

Documentation

data Decision Source #

Constructors

Allow 
Deny 

type Restriction = AddrInfo -> Decision Source #

restrictManagerSettings :: Maybe ConnectionContext -> Maybe TLSSettings -> Restriction -> ManagerSettings -> ManagerSettings Source #

Adjusts a ManagerSettings to enforce a Restriction. The restriction will be checked each time a Request is made, and for each redirect followed.

This overrides the managerRawConnection and managerTlsConnection with its own implementations that check the Restriction. They should otherwise behave the same as the ones provided by http-client-tls.

This function is not exported, because using it with a ManagerSettings produced by something other than http-client-tls would result in surprising behavior, since its connection methods would not be used.

mkRestrictedManagerSettings :: Restriction -> Maybe ConnectionContext -> Maybe TLSSettings -> ManagerSettings Source #

Makes a TLS-capable ManagerSettings with a Restriction applied to it.

The Restriction will be checked each time a Request is made, and for each redirect followed.

Aside from checking the Restriction, it should behave the same as mkManagerSettingsContext from http-client-tls.

 main = do
 	manager <- newManager $ mkRestrictedManagerSettings myRestriction Nothing Nothing
	request <- parseRequest "http://httpbin.org/get"
 	response <- httpLbs request manager
 	print $ responseBody response

See mkManagerSettingsContext for why it can be useful to provide a ConnectionContext.

Note that SOCKS is not supported.

wrapOurExceptions :: ManagerSettings -> Request -> IO a -> IO a Source #

restrictedRawConnection :: Restriction -> IO (Maybe HostAddress -> String -> Int -> IO Connection) Source #

restrictedTlsConnection :: Maybe ConnectionContext -> Maybe TLSSettings -> Restriction -> IO (Maybe HostAddress -> String -> Int -> IO Connection) Source #

getConnection :: Restriction -> Maybe TLSSettings -> Maybe ConnectionContext -> IO (Maybe HostAddress -> String -> Int -> IO Connection) Source #

convertConnection :: Connection -> IO Connection Source #