Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implementation of HttpClient
using the HTTP package
Synopsis
- withClient :: (Browser -> HttpLib -> IO a) -> IO a
- setOutHandler :: Browser -> (String -> IO ()) -> IO ()
- setErrHandler :: Browser -> (String -> IO ()) -> IO ()
- setProxy :: Browser -> ProxyConfig String -> IO ()
- request :: Throws IOException => Browser -> Request ByteString -> IO (Response ByteString)
- data Browser
- withBrowser :: forall a. Browser -> BrowserAction LazyStream a -> IO a
- data UnexpectedResponse = UnexpectedResponse URI (Int, Int, Int)
- data InvalidProxy = InvalidProxy String
Documentation
withClient :: (Browser -> HttpLib -> IO a) -> IO a Source #
Initialize the client
TODO: This currently uses the lazy bytestring API offered by the HTTP library. Unfortunately this provides no way of closing the connection when the callback decides it doens't require any further input. It seems impossible however to implement a proper streaming API. See https://github.com/haskell/HTTP/issues/86.
Additional operations
request :: Throws IOException => Browser -> Request ByteString -> IO (Response ByteString) Source #
Execute a single request
Low-level API
withBrowser :: forall a. Browser -> BrowserAction LazyStream a -> IO a Source #
Run a browser action
IMPLEMENTATION NOTE: the browse
action doesn't itself create any
connections, they are created on demand; we just need to make sure to carry
this state from one invocation of browse
to another.
Exception types
data UnexpectedResponse Source #
UnexpectedResponse URI (Int, Int, Int) |
Instances
Show UnexpectedResponse Source # | |
Defined in Hackage.Security.Client.Repository.HttpLib.HTTP showsPrec :: Int -> UnexpectedResponse -> ShowS # show :: UnexpectedResponse -> String # showList :: [UnexpectedResponse] -> ShowS # | |
Exception UnexpectedResponse Source # | |
Pretty UnexpectedResponse Source # | |
Defined in Hackage.Security.Client.Repository.HttpLib.HTTP pretty :: UnexpectedResponse -> String # |
data InvalidProxy Source #
Instances
Show InvalidProxy Source # | |
Defined in Hackage.Security.Client.Repository.HttpLib.HTTP showsPrec :: Int -> InvalidProxy -> ShowS # show :: InvalidProxy -> String # showList :: [InvalidProxy] -> ShowS # | |
Exception InvalidProxy Source # | |
Pretty InvalidProxy Source # | |
Defined in Hackage.Security.Client.Repository.HttpLib.HTTP pretty :: InvalidProxy -> String # |