http-conduit-2.3.8.1: HTTP client package with conduit interface and HTTPS support.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.HTTP.Client.Conduit

Description

A new, experimental API to replace Network.HTTP.Conduit.

For most users, Network.HTTP.Simple is probably a better choice. For more information, see:

https://haskell-lang.org/library/http-client

For more information on using this module, please be sure to read the documentation in the Network.HTTP.Client module.

Synopsis

Conduit-specific interface

withResponse :: (MonadUnliftIO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> (Response (ConduitM i ByteString n ()) -> m a) -> m a Source #

Conduit powered version of withResponse. Differences are:

  • Response body is represented as a Producer.
  • Generalized to any instance of MonadUnliftIO, not just IO.
  • The Manager is contained by a MonadReader context.

Since 2.1.0

responseOpen :: (MonadIO m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Response (ConduitM i ByteString n ())) Source #

Conduit-powered version of responseOpen.

See withResponse for the differences with responseOpen.

Since 2.1.0

responseClose :: MonadIO m => Response body -> m () Source #

Generalized version of responseClose.

Since 2.1.0

acquireResponse :: (MonadIO n, MonadReader env m, HasHttpManager env) => Request -> m (Acquire (Response (ConduitM i ByteString n ()))) Source #

An Acquire for getting a Response.

Since 2.1.0

httpSource :: (MonadResource m, MonadIO n, MonadReader env m, HasHttpManager env) => Request -> (Response (ConduitM () ByteString n ()) -> ConduitM () r m ()) -> ConduitM () r m () Source #

Same as httpSource, but uses Manager from Reader environment instead of the global one.

Since 2.3.6

Manager helpers

defaultManagerSettings :: ManagerSettings Source #

TLS-powered manager settings.

Since 2.1.0

newManager :: MonadIO m => m Manager Source #

Get a new manager using defaultManagerSettings.

Since 2.1.0

newManagerSettings :: MonadIO m => ManagerSettings -> m Manager Source #

Get a new manager using the given settings.

Since 2.1.0

General HTTP client interface

data Proxy #

Constructors

Proxy 

Instances

Instances details
Read Proxy 
Instance details

Defined in Network.HTTP.Client.Types

Show Proxy 
Instance details

Defined in Network.HTTP.Client.Types

Eq Proxy 
Instance details

Defined in Network.HTTP.Client.Types

Methods

(==) :: Proxy -> Proxy -> Bool Source #

(/=) :: Proxy -> Proxy -> Bool Source #

Ord Proxy 
Instance details

Defined in Network.HTTP.Client.Types

class HasHttpManager a where #

Methods

getHttpManager :: a -> Manager #

Instances

Instances details
HasHttpManager Manager 
Instance details

Defined in Network.HTTP.Client.Types

data Manager #

Instances

Instances details
HasHttpManager Manager 
Instance details

Defined in Network.HTTP.Client.Types

data Response body #

Instances

Instances details
Foldable Response 
Instance details

Defined in Network.HTTP.Client.Types

Methods

fold :: Monoid m => Response m -> m Source #

foldMap :: Monoid m => (a -> m) -> Response a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Response a -> m Source #

foldr :: (a -> b -> b) -> b -> Response a -> b Source #

foldr' :: (a -> b -> b) -> b -> Response a -> b Source #

foldl :: (b -> a -> b) -> b -> Response a -> b Source #

foldl' :: (b -> a -> b) -> b -> Response a -> b Source #

foldr1 :: (a -> a -> a) -> Response a -> a Source #

foldl1 :: (a -> a -> a) -> Response a -> a Source #

toList :: Response a -> [a] Source #

null :: Response a -> Bool Source #

length :: Response a -> Int Source #

elem :: Eq a => a -> Response a -> Bool Source #

maximum :: Ord a => Response a -> a Source #

minimum :: Ord a => Response a -> a Source #

sum :: Num a => Response a -> a Source #

product :: Num a => Response a -> a Source #

Traversable Response 
Instance details

Defined in Network.HTTP.Client.Types

Methods

traverse :: Applicative f => (a -> f b) -> Response a -> f (Response b) Source #

sequenceA :: Applicative f => Response (f a) -> f (Response a) Source #

mapM :: Monad m => (a -> m b) -> Response a -> m (Response b) Source #

sequence :: Monad m => Response (m a) -> m (Response a) Source #

Functor Response 
Instance details

Defined in Network.HTTP.Client.Types

Methods

fmap :: (a -> b) -> Response a -> Response b Source #

(<$) :: a -> Response b -> Response a Source #

Show body => Show (Response body) 
Instance details

Defined in Network.HTTP.Client.Types

Methods

showsPrec :: Int -> Response body -> ShowS Source #

show :: Response body -> String Source #

showList :: [Response body] -> ShowS Source #

data Request #

Instances

Instances details
Show Request 
Instance details

Defined in Network.HTTP.Client.Types

type GivesPopper a = NeedsPopper a -> IO a #

type NeedsPopper a = Popper -> IO a #

data HistoriedResponse body #

Instances

Instances details
Foldable HistoriedResponse 
Instance details

Defined in Network.HTTP.Client

Methods

fold :: Monoid m => HistoriedResponse m -> m Source #

foldMap :: Monoid m => (a -> m) -> HistoriedResponse a -> m Source #

foldMap' :: Monoid m => (a -> m) -> HistoriedResponse a -> m Source #

foldr :: (a -> b -> b) -> b -> HistoriedResponse a -> b Source #

foldr' :: (a -> b -> b) -> b -> HistoriedResponse a -> b Source #

foldl :: (b -> a -> b) -> b -> HistoriedResponse a -> b Source #

foldl' :: (b -> a -> b) -> b -> HistoriedResponse a -> b Source #

foldr1 :: (a -> a -> a) -> HistoriedResponse a -> a Source #

foldl1 :: (a -> a -> a) -> HistoriedResponse a -> a Source #

toList :: HistoriedResponse a -> [a] Source #

null :: HistoriedResponse a -> Bool Source #

length :: HistoriedResponse a -> Int Source #

elem :: Eq a => a -> HistoriedResponse a -> Bool Source #

maximum :: Ord a => HistoriedResponse a -> a Source #

minimum :: Ord a => HistoriedResponse a -> a Source #

sum :: Num a => HistoriedResponse a -> a Source #

product :: Num a => HistoriedResponse a -> a Source #

Traversable HistoriedResponse 
Instance details

Defined in Network.HTTP.Client

Functor HistoriedResponse 
Instance details

Defined in Network.HTTP.Client

Generic (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

Associated Types

type Rep (HistoriedResponse body) :: Type -> Type Source #

Show body => Show (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

type Rep (HistoriedResponse body) 
Instance details

Defined in Network.HTTP.Client

type Rep (HistoriedResponse body) = D1 ('MetaData "HistoriedResponse" "Network.HTTP.Client" "http-client-0.7.14-CSLgFyXjfrG1g6JsBLkVLh" 'False) (C1 ('MetaCons "HistoriedResponse" 'PrefixI 'True) (S1 ('MetaSel ('Just "hrRedirects") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Request, Response ByteString)]) :*: (S1 ('MetaSel ('Just "hrFinalRequest") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Request) :*: S1 ('MetaSel ('Just "hrFinalResponse") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Response body)))))

makeConnection :: IO ByteString -> (ByteString -> IO ()) -> IO () -> IO Connection #

socketConnection :: Socket -> Int -> IO Connection #

brReadSome :: BodyReader -> Int -> IO ByteString #

throwErrorStatusCodes :: MonadIO m => Request -> Response BodyReader -> m () #

getUri :: Request -> URI #

rawConnectionModifySocket :: (Socket -> IO ()) -> IO (Maybe HostAddress -> String -> Int -> IO Connection) #

rawConnectionModifySocketSize :: (Socket -> IO ()) -> IO (Int -> Maybe HostAddress -> String -> Int -> IO Connection) #

generateCookie :: SetCookie -> Request -> UTCTime -> Bool -> Maybe Cookie #

withConnection :: Request -> Manager -> (Connection -> IO a) -> IO a #

withResponseHistory :: Request -> Manager -> (HistoriedResponse BodyReader -> IO a) -> IO a #

httpLbs :: (MonadIO m, HasHttpManager env, MonadReader env m) => Request -> m (Response ByteString) Source #

Same as httpLbs, except it uses the Manager in the reader environment.

Since 2.1.1

httpNoBody :: (MonadIO m, HasHttpManager env, MonadReader env m) => Request -> m (Response ()) Source #

Same as httpNoBody, except it uses the Manager in the reader environment.

This can be more convenient that using withManager as it avoids the need to specify the base monad for the response body.

Since 2.1.2

Lower-level conduit functions

bodyReaderSource :: MonadIO m => BodyReader -> ConduitM i ByteString m () Source #