Network.HTTP.Client.Internal

http-client-0.7.18: An HTTP client engine

Safe Haskell | None
Language | Haskell2010

Network.HTTP.Client.Internal

Contents

- Low-level response body handling
- Raw connection handling
- Cookies
- Performing requests
- Parse response headers
- Request helper functions
- Low-level response body handling
- Manager
- All types
- Various utilities

Description

Note that this is essentially the "kitchen sink" export module, including many functions intended only to be used internally by this package. No API stability is guaranteed for this module. If you see functions here which you believe should be promoted to a stable API, please contact the author.

Synopsis

- brRead :: BodyReader -> IO ByteString
- brReadSome :: BodyReader -> Int -> IO ByteString
- brConsume :: BodyReader -> IO [ByteString]
- makeChunkedReader :: Maybe MaxHeaderLength -> IO () -> Bool -> Connection -> IO BodyReader
- makeLengthReader :: IO () -> Int -> Connection -> IO BodyReader
- makeGzipReader :: BodyReader -> IO BodyReader
- makeUnlimitedReader :: IO () -> Connection -> IO BodyReader
- brEmpty :: BodyReader
- constBodyReader :: [ByteString] -> IO BodyReader
- makeConnection :: IO ByteString -> (ByteString -> IO ()) -> IO () -> IO Connection
- socketConnection :: Socket -> Int -> IO Connection
- strippedHostName :: String -> String
- connectionReadLine :: Maybe MaxHeaderLength -> Connection -> IO ByteString
- connectionReadLineWith :: Maybe MaxHeaderLength -> Connection -> ByteString -> IO ByteString
- connectionDropTillBlankLine :: Maybe MaxHeaderLength -> Connection -> IO ()
- connectionUnreadLine :: Connection -> ByteString -> IO ()
- dummyConnection :: [ByteString] -> IO (Connection, IO [ByteString], IO [ByteString])
- openSocketConnection :: (Socket -> IO ()) -> Maybe HostAddress -> String -> Int -> IO Connection
- openSocketConnectionSize :: (Socket -> IO ()) -> Int -> Maybe HostAddress -> String -> Int -> IO Connection
- withSocket :: (Socket -> IO ()) -> Maybe HostAddress -> String -> Int -> (Socket -> IO a) -> IO a
- updateCookieJar :: Response a -> Request -> UTCTime -> CookieJar -> (CookieJar, Response a)
- receiveSetCookie :: SetCookie -> Request -> UTCTime -> Bool -> CookieJar -> CookieJar
- generateCookie :: SetCookie -> Request -> UTCTime -> Bool -> Maybe Cookie
- insertCheckedCookie :: Cookie -> CookieJar -> Bool -> CookieJar
- insertCookiesIntoRequest :: Request -> CookieJar -> UTCTime -> (Request, CookieJar)
- computeCookieString :: Request -> CookieJar -> UTCTime -> Bool -> (ByteString, CookieJar)
- evictExpiredCookies :: CookieJar -> UTCTime -> CookieJar
- createCookieJar :: [Cookie] -> CookieJar
- destroyCookieJar :: CookieJar -> [Cookie]
- pathMatches :: ByteString -> ByteString -> Bool
- removeExistingCookieFromCookieJar :: Cookie -> CookieJar -> (Maybe Cookie, CookieJar)
- domainMatches :: ByteString -> ByteString -> Bool
- isIpAddress :: ByteString -> Bool
- isPotentiallyTrustworthyOrigin :: Bool -> ByteString -> Bool
- defaultPath :: Request -> ByteString
- withResponse :: Request -> Manager -> (Response BodyReader -> IO a) -> IO a
- httpLbs :: Request -> Manager -> IO (Response ByteString)
- httpNoBody :: Request -> Manager -> IO (Response ())
- responseOpen :: Request -> Manager -> IO (Response BodyReader)
- responseClose :: Response a -> IO ()
- withConnection :: Request -> Manager -> (Connection -> IO a) -> IO a
- httpRaw :: Request -> Manager -> IO (Response BodyReader)
- httpRaw' :: Request -> Manager -> IO (Request, Response BodyReader)
- getModifiedRequestManager :: Manager -> Request -> IO (Manager, Request)
- httpRedirect :: Int -> (Request -> IO (Response BodyReader, Maybe Request)) -> Request -> IO (Response BodyReader)
- httpRedirect' :: Int -> (Request -> IO (Response BodyReader, Request, Bool)) -> Request -> IO (Request, Response BodyReader)
- handleClosedRead :: SomeException -> IO ByteString
- parseStatusHeaders :: Maybe MaxHeaderLength -> Maybe MaxNumberHeaders -> Connection -> Maybe Int -> ([Header] -> IO ()) -> Maybe (IO ()) -> IO StatusHeaders
- validateHeaders :: RequestHeaders -> HeadersValidationResult
- data HeadersValidationResult
  - = GoodHeaders
  - | BadHeaders ByteString
- parseUrl :: MonadThrow m => String -> m Request
- parseUrlThrow :: MonadThrow m => String -> m Request
- parseRequest :: MonadThrow m => String -> m Request
- parseRequest_ :: String -> Request
- requestFromURI :: MonadThrow m => URI -> m Request
- requestFromURI_ :: URI -> Request
- defaultRequest :: Request
- applyBasicAuth :: ByteString -> ByteString -> Request -> Request
- applyBearerAuth :: ByteString -> Request -> Request
- urlEncodedBody :: [(ByteString, ByteString)] -> Request -> Request
- getUri :: Request -> URI
- setRequestIgnoreStatus :: Request -> Request
- setRequestCheckStatus :: Request -> Request
- setQueryString :: [(ByteString, Maybe ByteString)] -> Request -> Request
- setQueryStringPartialEscape :: [(ByteString, [EscapeItem])] -> Request -> Request
- applyBasicProxyAuth :: ByteString -> ByteString -> Request -> Request
- streamFile :: FilePath -> IO RequestBody
- observedStreamFile :: (StreamFileStatus -> IO ()) -> FilePath -> IO RequestBody
- throwErrorStatusCodes :: MonadIO m => Request -> Response BodyReader -> m ()
- setUriRelative :: MonadThrow m => Request -> URI -> m Request
- setUri :: MonadThrow m => Request -> URI -> m Request
- setUriEither :: Request -> URI -> Either String Request
- browserDecompress :: ByteString -> Bool
- alwaysDecompress :: ByteString -> Bool
- addProxy :: ByteString -> Int -> Request -> Request
- needsGunzip :: Request -> [Header] -> Bool
- requestBuilder :: Request -> Connection -> IO (Maybe (IO ()))
- extractBasicAuthInfo :: URI -> Maybe (ByteString, ByteString)
- addProxySecureWithoutConnect :: Request -> Request
- getOriginalRequest :: Response a -> Request
- getRedirectedRequest :: Request -> Request -> ResponseHeaders -> CookieJar -> Int -> Maybe Request
- getResponse :: Maybe MaxHeaderLength -> Maybe MaxNumberHeaders -> Maybe Int -> Request -> Managed Connection -> Maybe (IO ()) -> IO (Response BodyReader)
- lbsResponse :: Response BodyReader -> IO (Response ByteString)
- newManager :: ManagerSettings -> IO Manager
- closeManager :: Manager -> IO ()
- withManager :: ManagerSettings -> (Manager -> IO a) -> IO a
- data ManagerSettings = ManagerSettings {
  - managerConnCount :: Int
  - managerRawConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection)
  - managerTlsConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection)
  - managerTlsProxyConnection :: IO (ByteString -> (Connection -> IO ()) -> String -> Maybe HostAddress -> String -> Int -> IO Connection)
  - managerResponseTimeout :: ResponseTimeout
  - managerRetryableException :: SomeException -> Bool
  - managerWrapException :: forall a. Request -> IO a -> IO a
  - managerIdleConnectionCount :: Int
  - managerModifyRequest :: Request -> IO Request
  - managerModifyResponse :: Response BodyReader -> IO (Response BodyReader)
  - managerProxyInsecure :: ProxyOverride
  - managerProxySecure :: ProxyOverride
  - managerMaxHeaderLength :: Maybe MaxHeaderLength
  - managerMaxNumberHeaders :: Maybe MaxNumberHeaders
  }
- defaultManagerSettings :: ManagerSettings
- proxyFromRequest :: ProxyOverride
- noProxy :: ProxyOverride
- useProxy :: Proxy -> ProxyOverride
- useProxySecureWithoutConnect :: Proxy -> ProxyOverride
- proxyEnvironment :: Maybe Proxy -> ProxyOverride
- proxyEnvironmentNamed :: Text -> Maybe Proxy -> ProxyOverride
- defaultProxy :: ProxyOverride
- rawConnectionModifySocket :: (Socket -> IO ()) -> IO (Maybe HostAddress -> String -> Int -> IO Connection)
- rawConnectionModifySocketSize :: (Socket -> IO ()) -> IO (Int -> Maybe HostAddress -> String -> Int -> IO Connection)
- getConn :: Request -> Manager -> IO (Managed Connection)
- dropProxyAuthSecure :: Request -> Request
- data NonEmptyList a
  - = One a UTCTime
  - | Cons a Int UTCTime (NonEmptyList a)
- data Proxy = Proxy {
  - proxyHost :: ByteString
  - proxyPort :: Int
  }
- data Request = Request {
  - method :: Method
  - secure :: Bool
  - host :: ByteString
  - port :: Int
  - path :: ByteString
  - queryString :: ByteString
  - requestHeaders :: RequestHeaders
  - requestBody :: RequestBody
  - proxy :: Maybe Proxy
  - hostAddress :: Maybe HostAddress
  - rawBody :: Bool
  - decompress :: ByteString -> Bool
  - redirectCount :: Int
  - checkResponse :: Request -> Response BodyReader -> IO ()
  - responseTimeout :: ResponseTimeout
  - cookieJar :: Maybe CookieJar
  - requestVersion :: HttpVersion
  - onRequestBodyException :: SomeException -> IO ()
  - requestManagerOverride :: Maybe Manager
  - shouldStripHeaderOnRedirect :: HeaderName -> Bool
  - shouldStripHeaderOnRedirectIfOnDifferentHostOnly :: Bool
  - proxySecureMode :: ProxySecureMode
  - redactHeaders :: Set HeaderName
  - earlyHintHeadersReceived :: [Header] -> IO ()
  }
- data ConnHost
  - = HostName Text
  - | HostAddress HostAddress
- type Popper = IO ByteString
- data StreamFileStatus = StreamFileStatus {
  - fileSize :: Int64
  - readSoFar :: Int64
  - thisChunkSize :: Int
  }
- data Manager = Manager {
  - mConns :: KeyedPool ConnKey Connection
  - mResponseTimeout :: ResponseTimeout
  - mRetryableException :: SomeException -> Bool
  - mWrapException :: forall a. Request -> IO a -> IO a
  - mModifyRequest :: Request -> IO Request
  - mSetProxy :: Request -> Request
  - mModifyResponse :: Response BodyReader -> IO (Response BodyReader)
  - mMaxHeaderLength :: Maybe MaxHeaderLength
  - mMaxNumberHeaders :: Maybe MaxNumberHeaders
  }
- class HasHttpManager a where
  - getHttpManager :: a -> Manager
- data ManagerSettings = ManagerSettings {
  - managerConnCount :: Int
  - managerRawConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection)
  - managerTlsConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection)
  - managerTlsProxyConnection :: IO (ByteString -> (Connection -> IO ()) -> String -> Maybe HostAddress -> String -> Int -> IO Connection)
  - managerResponseTimeout :: ResponseTimeout
  - managerRetryableException :: SomeException -> Bool
  - managerWrapException :: forall a. Request -> IO a -> IO a
  - managerIdleConnectionCount :: Int
  - managerModifyRequest :: Request -> IO Request
  - managerModifyResponse :: Response BodyReader -> IO (Response BodyReader)
  - managerProxyInsecure :: ProxyOverride
  - managerProxySecure :: ProxyOverride
  - managerMaxHeaderLength :: Maybe MaxHeaderLength
  - managerMaxNumberHeaders :: Maybe MaxNumberHeaders
  }
- newtype ProxyOverride = ProxyOverride {
  - runProxyOverride :: Bool -> IO (Request -> Request)
  }
- data ResponseTimeout
  - = ResponseTimeoutMicro !Int
  - | ResponseTimeoutNone
  - | ResponseTimeoutDefault
- data HttpExceptionContent
  - = StatusCodeException (Response ()) ByteString
  - | TooManyRedirects [Response ByteString]
  - | OverlongHeaders
  - | TooManyHeaderFields
  - | ResponseTimeout
  - | ConnectionTimeout
  - | ConnectionFailure SomeException
  - | InvalidStatusLine ByteString
  - | InvalidHeader ByteString
  - | InvalidRequestHeader ByteString
  - | InternalException SomeException
  - | ProxyConnectException ByteString Int Status
  - | NoResponseDataReceived
  - | TlsNotSupported
  - | WrongRequestBodyStreamSize Word64 Word64
  - | ResponseBodyTooShort Word64 Word64
  - | InvalidChunkHeaders
  - | IncompleteHeaders
  - | InvalidDestinationHost ByteString
  - | HttpZlibException ZlibException
  - | InvalidProxyEnvironmentVariable Text Text
  - | ConnectionClosed
  - | InvalidProxySettings Text
- data RequestBody
  - = RequestBodyLBS ByteString
  - | RequestBodyBS ByteString
  - | RequestBodyBuilder Int64 Builder
  - | RequestBodyStream Int64 (GivesPopper ())
  - | RequestBodyStreamChunked (GivesPopper ())
  - | RequestBodyIO (IO RequestBody)
- type NeedsPopper a = Popper -> IO a
- type GivesPopper a = NeedsPopper a -> IO a
- data Response body = Response {
  - responseStatus :: Status
  - responseVersion :: HttpVersion
  - responseHeaders :: ResponseHeaders
  - responseBody :: body
  - responseCookieJar :: CookieJar
  - responseClose' :: ResponseClose
  - responseOriginalRequest :: Request
  - responseEarlyHints :: ResponseHeaders
  }
- type BodyReader = IO ByteString
- data HttpException
  - = HttpExceptionRequest Request HttpExceptionContent
  - | InvalidUrlException String String
- data Cookie = Cookie {
  - cookie_name :: ByteString
  - cookie_value :: ByteString
  - cookie_expiry_time :: UTCTime
  - cookie_domain :: ByteString
  - cookie_path :: ByteString
  - cookie_creation_time :: UTCTime
  - cookie_last_access_time :: UTCTime
  - cookie_persistent :: Bool
  - cookie_host_only :: Bool
  - cookie_secure_only :: Bool
  - cookie_http_only :: Bool
  }
- equalCookie :: Cookie -> Cookie -> Bool
- equivCookie :: Cookie -> Cookie -> Bool
- compareCookies :: Cookie -> Cookie -> Ordering
- newtype CookieJar = CJ {
  - expose :: [Cookie]
  }
- equalCookieJar :: CookieJar -> CookieJar -> Bool
- equivCookieJar :: CookieJar -> CookieJar -> Bool
- data Connection = Connection {
  - connectionRead :: IO ByteString
  - connectionUnread :: ByteString -> IO ()
  - connectionWrite :: ByteString -> IO ()
  - connectionClose :: IO ()
  }
- data StatusHeaders = StatusHeaders Status HttpVersion RequestHeaders RequestHeaders
- unHttpExceptionContentWrapper :: HttpExceptionContentWrapper -> HttpExceptionContent
- throwHttp :: HttpExceptionContent -> IO a
- toHttpException :: Request -> HttpExceptionContentWrapper -> HttpException
- newtype ResponseClose = ResponseClose {
  - runResponseClose :: IO ()
  }
- data ConnsMap
  - = ManagerClosed
  - | ManagerOpen !Int !(Map ConnKey (NonEmptyList Connection))
- data ConnKey
  - = CKRaw (Maybe HostAddress) !ByteString !Int
  - | CKSecure (Maybe HostAddress) !ByteString !Int
  - | CKProxy !ByteString !Int (Maybe ByteString) !ByteString !Int
- data ProxySecureMode
  - = ProxySecureWithConnect
  - | ProxySecureWithoutConnect
- newtype MaxHeaderLength = MaxHeaderLength {
  - unMaxHeaderLength :: Int
  }
- newtype MaxNumberHeaders = MaxNumberHeaders {
  - unMaxNumberHeaders :: Int
  }
- readPositiveInt :: String -> Maybe Int
- dummyManaged :: resource -> Managed resource

# Low-level response body handling

brRead :: BodyReader -> IO ByteString #

Get a single chunk of data from the response body, or an empty bytestring if no more data is available.

Note that in order to consume the entire request body, you will need to repeatedly call this function until you receive an empty `ByteString` as a result.

Since 0.1.0

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

Continuously call `brRead`, building up a lazy ByteString until a chunk is constructed that is at least as many bytes as requested.

Since 0.4.20

brConsume :: BodyReader -> IO [ByteString] #

Strictly consume all remaining chunks of data from the stream.

Since 0.1.0

makeChunkedReader #

Arguments

:: Maybe MaxHeaderLength |
-> IO () | cleanup
-> Bool | raw
-> Connection |
-> IO BodyReader |

makeLengthReader #

Arguments

:: IO () | cleanup
-> Int |
-> Connection |
-> IO BodyReader |

makeGzipReader :: BodyReader -> IO BodyReader #

makeUnlimitedReader #

Arguments

:: IO () | cleanup
-> Connection |
-> IO BodyReader |

brEmpty :: BodyReader #

constBodyReader :: [ByteString] -> IO BodyReader #

# Raw connection handling

makeConnection #

Arguments

:: IO ByteString | read
-> (ByteString -> IO ()) | write
-> IO () | close
-> IO Connection |

Create a new `Connection` from a read, write, and close function.

Since: 0.5.3

socketConnection #

Arguments

:: Socket |
-> Int | chunk size
-> IO Connection |

Create a new `Connection` from a `Socket`.

Since: 0.5.3

strippedHostName :: String -> String #

strippedHostName takes a URI host name, as extracted by `regName`, and strips square brackets around IPv6 addresses.

The result is suitable for passing to services such as name resolution (`getAddr`).

@since

connectionReadLine :: Maybe MaxHeaderLength -> Connection -> IO ByteString #

connectionReadLineWith :: Maybe MaxHeaderLength -> Connection -> ByteString -> IO ByteString #

connectionDropTillBlankLine :: Maybe MaxHeaderLength -> Connection -> IO () #

Keep dropping input until a blank line is found.

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

dummyConnection #

Arguments

:: [ByteString] | input
-> IO (Connection, IO [ByteString], IO [ByteString]) | conn, output, input

For testing

openSocketConnection #

Arguments

:: (Socket -> IO ()) |
-> Maybe HostAddress |
-> String | host
-> Int | port
-> IO Connection |

openSocketConnectionSize #

Arguments

:: (Socket -> IO ()) |
-> Int | chunk size
-> Maybe HostAddress |
-> String | host
-> Int | port
-> IO Connection |

withSocket #

Arguments

:: (Socket -> IO ()) |
-> Maybe HostAddress |
-> String | host
-> Int | port
-> (Socket -> IO a) |
-> IO a |

# Cookies

updateCookieJar #

Arguments

:: Response a | Response received from server
-> Request | Request which generated the response
-> UTCTime | Value that should be used as "now"
-> CookieJar | Current cookie jar
-> (CookieJar, Response a) | (Updated cookie jar with cookies from the Response, The response stripped of any "Set-Cookie" header)

This applies `receiveSetCookie` to a given Response

receiveSetCookie #

Arguments

:: SetCookie | The `SetCookie` the cookie jar is receiving
-> Request | The request that originated the response that yielded the `SetCookie`
-> UTCTime | Value that should be used as "now"
-> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that)
-> CookieJar | Input cookie jar to modify
-> CookieJar | Updated cookie jar

This corresponds to the algorithm described in Section 5.3 "Storage Model" This function consists of calling `generateCookie` followed by `insertCheckedCookie`. Use this function if you plan to do both in a row. `generateCookie` and `insertCheckedCookie` are only provided for more fine-grained control.

generateCookie #

Arguments

:: SetCookie | The `SetCookie` we are encountering
-> Request | The request that originated the response that yielded the `SetCookie`
-> UTCTime | Value that should be used as "now"
-> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that)
-> Maybe Cookie | The optional output cookie

Turn a SetCookie into a Cookie, if it is valid

insertCheckedCookie #

Arguments

:: Cookie | The `SetCookie` the cookie jar is receiving
-> CookieJar | Input cookie jar to modify
-> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that)
-> CookieJar | Updated (or not) cookie jar

Insert a cookie created by generateCookie into the cookie jar (or not if it shouldn't be allowed in)

insertCookiesIntoRequest #

Arguments

:: Request | The request to insert into
-> CookieJar | Current cookie jar
-> UTCTime | Value that should be used as "now"
-> (Request, CookieJar) | (Output request, Updated cookie jar (last-access-time is updated))

This applies the `computeCookieString` to a given Request

computeCookieString #

Arguments

:: Request | Input request
-> CookieJar | Current cookie jar
-> UTCTime | Value that should be used as "now"
-> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that)
-> (ByteString, CookieJar) | (Contents of a "Cookie" header, Updated cookie jar (last-access-time is updated))

This corresponds to the algorithm described in Section 5.4 "The Cookie Header"

evictExpiredCookies #

Arguments

:: CookieJar | Input cookie jar
-> UTCTime | Value that should be used as "now"
-> CookieJar | Filtered cookie jar

This corresponds to the eviction algorithm described in Section 5.3 "Storage Model"

createCookieJar :: [Cookie] -> CookieJar #

destroyCookieJar :: CookieJar -> [Cookie] #

pathMatches :: ByteString -> ByteString -> Bool #

This corresponds to the subcomponent algorithm entitled "Path-Match" detailed in section 5.1.4

removeExistingCookieFromCookieJar :: Cookie -> CookieJar -> (Maybe Cookie, CookieJar) #

domainMatches #

Arguments

:: ByteString | Domain to test
-> ByteString | Domain from a cookie
-> Bool |

This corresponds to the subcomponent algorithm entitled "Domain Matching" detailed in section 5.1.3

isIpAddress :: ByteString -> Bool #

isPotentiallyTrustworthyOrigin #

Arguments

:: Bool | True if HTTPS
-> ByteString | Host
-> Bool | Whether or not the origin is potentially trustworthy

Algorithm described in "Secure Contexts", Section 3.1, "Is origin potentially trustworthy?"

Note per RFC6265 section 5.4 user agent is free to define the meaning of "secure" protocol.

See: https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy

defaultPath :: Request -> ByteString #

This corresponds to the subcomponent algorithm entitled "Paths" detailed in section 5.1.4

# Performing requests

withResponse :: Request -> Manager -> (Response BodyReader -> IO a) -> IO a #

Perform a `Request` using a connection acquired from the given `Manager`, and then provide the `Response` to the given function. This function is fully exception safe, guaranteeing that the response will be closed when the inner function exits. It is defined as:

    withResponse req man f = bracket (responseOpen req man) responseClose f

It is recommended that you use this function in place of explicit calls to `responseOpen` and `responseClose`.

You will need to use functions such as `brRead` to consume the response body.

Since 0.1.0

httpLbs :: Request -> Manager -> IO (Response ByteString) #

A convenience wrapper around `withResponse` which reads in the entire response body and immediately closes the connection. Note that this function performs fully strict I/O, and only uses a lazy ByteString in its response for memory efficiency. If you are anticipating a large response body, you are encouraged to use `withResponse` and `brRead` instead.

Since 0.1.0

httpNoBody :: Request -> Manager -> IO (Response ()) #

A convenient wrapper around `withResponse` which ignores the response body. This is useful, for example, when performing a HEAD request.

Since 0.3.2

responseOpen :: Request -> Manager -> IO (Response BodyReader) #

The most low-level function for initiating an HTTP request.

The first argument to this function gives a full specification on the request: the host to connect to, whether to use SSL, headers, etc. Please see `Request` for full details. The second argument specifies which `Manager` should be used.

This function then returns a `Response` with a `BodyReader`. The `Response` contains the status code and headers that were sent back to us, and the `BodyReader` contains the body of the request. Note that this `BodyReader` allows you to have fully interleaved IO actions during your HTTP download, making it possible to download very large responses in constant memory.

An important note: the response body returned by this function represents a live HTTP connection. As such, if you do not use the response body, an open socket will be retained indefinitely. You must be certain to call `responseClose` on this response to free up resources.

This function automatically performs any necessary redirects, as specified by the `redirectCount` setting.

When implementing a (reverse) proxy using this function or relating functions, it's wise to remove Transfer-Encoding:, Content-Length:, Content-Encoding: and Accept-Encoding: from request and response headers to be relayed.

Since 0.1.0

responseClose :: Response a -> IO () #

Close any open resources associated with the given `Response`. In general, this will either close an active `Connection` or return it to the `Manager` to be reused.

Since 0.1.0

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

Perform an action using a `Connection` acquired from the given `Manager`.

You should use this only when you have to read and write interactively through the connection (e.g. connection by the WebSocket protocol).

Since: 0.5.13

httpRaw :: Request -> Manager -> IO (Response BodyReader) #

Get a `Response` without any redirect following.

httpRaw' :: Request -> Manager -> IO (Request, Response BodyReader) #

Get a `Response` without any redirect following.

This extended version of `httpRaw` also returns the potentially modified Request.

getModifiedRequestManager :: Manager -> Request -> IO (Manager, Request) #

The used Manager can be overridden (by requestManagerOverride) and the used Request can be modified (through managerModifyRequest). This function allows to retrieve the possibly overridden Manager and the possibly modified Request.

(In case the Manager is overridden by requestManagerOverride, the Request is being modified by managerModifyRequest of the new Manager, not the old one.)

httpRedirect #

Arguments

:: Int | `redirectCount`
-> (Request -> IO (Response BodyReader, Maybe Request)) | function which performs a request and returns a response, and possibly another request if there's a redirect.
-> Request |
-> IO (Response BodyReader) |

Redirect loop.

httpRedirect' #

Arguments

:: Int | `redirectCount`
-> (Request -> IO (Response BodyReader, Request, Bool)) | function which performs a request and returns a response, the potentially modified request, and a Bool indicating if there was a redirect.
-> Request |
-> IO (Request, Response BodyReader) |

Redirect loop.

This extended version of `httpRaw` also returns the Request potentially modified by `managerModifyRequest`.

handleClosedRead :: SomeException -> IO ByteString #

# Parse response headers

parseStatusHeaders :: Maybe MaxHeaderLength -> Maybe MaxNumberHeaders -> Connection -> Maybe Int -> ([Header] -> IO ()) -> Maybe (IO ()) -> IO StatusHeaders #

validateHeaders :: RequestHeaders -> HeadersValidationResult #

data HeadersValidationResult #

Constructors

GoodHeaders |
BadHeaders ByteString |

# Request helper functions

parseUrl :: MonadThrow m => String -> m Request #

Deprecated: Please use parseUrlThrow, parseRequest, or parseRequest_ instead

Deprecated synonym for `parseUrlThrow`. You probably want `parseRequest` or `parseRequest_` instead.

Since: 0.1.0

parseUrlThrow :: MonadThrow m => String -> m Request #

Same as `parseRequest`, except will throw an `HttpException` in the event of a non-2XX response. This uses `throwErrorStatusCodes` to implement `checkResponse`.

Since: 0.4.30

parseRequest :: MonadThrow m => String -> m Request #

Convert a URL into a `Request`.

This function defaults some of the values in `Request`, such as setting `method` to `GET` and `requestHeaders` to `[]`.

Since this function uses `MonadThrow`, the return monad can be anything that is an instance of `MonadThrow`, such as `IO` or `Maybe`.

You can place the request method at the beginning of the URL separated by a space, e.g.:

    parseRequest "POST http://httpbin.org/post"

Note that the request method must be provided as all capital letters.

A `Request` created by this function won't cause exceptions on non-2XX response status codes.

To create a request which throws on non-2XX status codes, see `parseUrlThrow`

Since: 0.4.30

parseRequest_ :: String -> Request #

Same as `parseRequest`, but parse errors cause an impure exception. Mostly useful for static strings which are known to be correctly formatted.

requestFromURI :: MonadThrow m => URI -> m Request #

Convert a `URI` into a `Request`.

This can fail if the given `URI` is not absolute, or if the `URI` scheme is not `"http"` or `"https"`. In these cases the function will throw an error via `MonadThrow`.

This function defaults some of the values in `Request`, such as setting `method` to `GET` and `requestHeaders` to `[]`.

A `Request` created by this function won't cause exceptions on non-2XX response status codes.

Since: 0.5.12

requestFromURI_ :: URI -> Request #

Same as `requestFromURI`, but if the conversion would fail, throws an impure exception.

Since: 0.5.12

defaultRequest :: Request #

A default request value, a GET request of localhost/:80, with an empty request body.

Note that the default `checkResponse` does nothing.

Since: 0.4.30

applyBasicAuth :: ByteString -> ByteString -> Request -> Request #

Add a Basic Auth header (with the specified user name and password) to the given Request. Ignore error handling:

     applyBasicAuth "user" "pass" $ parseRequest_ url

NOTE: The function `applyDigestAuth` is provided by the `http-client-tls` package instead of this package due to extra dependencies. Please use that package if you need to use digest authentication.

Since 0.1.0

applyBearerAuth :: ByteString -> Request -> Request #

Add a Bearer Auth header to the given `Request`

Since: 0.7.6

urlEncodedBody :: [(ByteString, ByteString)] -> Request -> Request #

Add url-encoded parameters to the `Request`.

This sets a new `requestBody`, adds a content-type request header and changes the `method` to POST.

Since 0.1.0

getUri :: Request -> URI #

Extract a `URI` from the request.

Since 0.1.0

setRequestIgnoreStatus :: Request -> Request #

Modify the request so that non-2XX status codes do not generate a runtime `StatusCodeException`.

Since: 0.4.29

setRequestCheckStatus :: Request -> Request #

Modify the request so that non-2XX status codes generate a runtime `StatusCodeException`, by using `throwErrorStatusCodes`

Since: 0.5.13

setQueryString :: [(ByteString, Maybe ByteString)] -> Request -> Request #

Set the query string to the given key/value pairs.

Since 0.3.6

setQueryStringPartialEscape :: [(ByteString, [EscapeItem])] -> Request -> Request #

Set the query string to the given key/value pairs.

Since: 0.5.10

applyBasicProxyAuth :: ByteString -> ByteString -> Request -> Request #

Add a Proxy-Authorization header (with the specified username and password) to the given `Request`. Ignore error handling:

    applyBasicProxyAuth "user" "pass" <$> parseRequest "http://example.org"

Since 0.3.4

streamFile :: FilePath -> IO RequestBody #

Send a file as the request body.

It is expected that the file size does not change between calling `streamFile` and making any requests using this request body.

Since 0.4.9

observedStreamFile :: (StreamFileStatus -> IO ()) -> FilePath -> IO RequestBody #

Send a file as the request body, while observing streaming progress via a `PopObserver`. Observations are made between reading and sending a chunk.

It is expected that the file size does not change between calling `observedStreamFile` and making any requests using this request body.

Since 0.4.9

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

Throws a `StatusCodeException` wrapped in `HttpExceptionRequest`, if the response's status code indicates an error (if it isn't 2xx). This can be used to implement `checkResponse`.

Since: 0.5.13

setUriRelative :: MonadThrow m => Request -> URI -> m Request #

Add a `URI` to the request. If it is absolute (includes a host name), add it as per `setUri`; if it is relative, merge it with the existing request.

setUri :: MonadThrow m => Request -> URI -> m Request #

Validate a `URI`, then add it to the request.

setUriEither :: Request -> URI -> Either String Request #

A variant of `setUri` that returns an error message on validation errors, instead of propagating them with `throwM`.

Since: 0.6.1

browserDecompress :: ByteString -> Bool #

Decompress a compressed stream unless the content-type is 'application/x-tar'.

alwaysDecompress :: ByteString -> Bool #

Always decompress a compressed stream.

addProxy :: ByteString -> Int -> Request -> Request #

Add a proxy to the Request so that the Request when executed will use the provided proxy.

Since 0.1.0

needsGunzip #

Arguments

:: Request |
-> [Header] | response headers
-> Bool |

requestBuilder :: Request -> Connection -> IO (Maybe (IO ())) #

extractBasicAuthInfo :: URI -> Maybe (ByteString, ByteString) #

Extract basic access authentication info in URI. Return Nothing when there is no auth info in URI.

addProxySecureWithoutConnect :: Request -> Request #

Send secure requests to the proxy in plain text rather than using CONNECT.

Since: 0.7.2

# Low-level response body handling

getOriginalRequest :: Response a -> Request #

Retrieve the orignal `Request` from a `Response`

Note that the `requestBody` is not available and always set to empty.

Since: 0.7.8

getRedirectedRequest :: Request -> Request -> ResponseHeaders -> CookieJar -> Int -> Maybe Request #

If a request is a redirection (status code 3xx) this function will create a new request from the old request, the server headers returned with the redirection, and the redirection code itself. This function returns `Nothing` if the code is not a 3xx, there is no `location` header included, or if the redirected response couldn't be parsed with `parseRequest`.

If a user of this library wants to know the url chain that results from a specific request, that user has to re-implement the redirect-following logic themselves. An example of that might look like this:

    myHttp req man = do
       (res, redirectRequests) <- (`runStateT` []) $
            'httpRedirect'
                9000
                (\req' -> do
                   res <- http req'{redirectCount=0} man
                   modify (\rqs -> req' : rqs)
                   return (res, getRedirectedRequest req req' (responseHeaders res) (responseCookieJar res) (W.statusCode (responseStatus res))
                   )
                'lift'
                req
       applyCheckStatus (checkStatus req) res
       return redirectRequests

getResponse #

Arguments

:: Maybe MaxHeaderLength |
-> Maybe MaxNumberHeaders |
-> Maybe Int |
-> Request |
-> Managed Connection |
-> Maybe (IO ()) | Action to run in case of a '100 Continue'.
-> IO (Response BodyReader) |

lbsResponse :: Response BodyReader -> IO (Response ByteString) #

Convert a `Response` that has a `Source` body to one with a lazy `ByteString` body.

# Manager

newManager :: ManagerSettings -> IO Manager #

Create a `Manager`. The `Manager` will be shut down automatically via garbage collection.

Creating a new `Manager` is a relatively expensive operation, you are advised to share a single `Manager` between requests instead.

The first argument to this function is often `defaultManagerSettings`, though add-on libraries may provide a recommended replacement.

Since 0.1.0

closeManager :: Manager -> IO () #

Deprecated: Manager will be closed for you automatically when no longer in use

Close all connections in a `Manager`.

Note that this doesn't affect currently in-flight connections, meaning you can safely use it without hurting any queries you may have concurrently running.

Since 0.1.0

withManager :: ManagerSettings -> (Manager -> IO a) -> IO a #

Deprecated: Use newManager instead

Create, use and close a `Manager`.

Since 0.2.1

data ManagerSettings #

Settings for a `Manager`. Please use the `defaultManagerSettings` function and then modify individual settings. For more information, see http://www.yesodweb.com/book/settings-types.

Since 0.1.0

Constructors

ManagerSettings |
Fields managerConnCount :: Int Number of connections to a single host to keep alive. Default: 10. Since 0.1.0 managerRawConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection) Create an insecure connection. Since 0.1.0 managerTlsConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection) Create a TLS connection. Default behavior: throw an exception that TLS is not supported. Since 0.1.0 managerTlsProxyConnection :: IO (ByteString -> (Connection -> IO ()) -> String -> Maybe HostAddress -> String -> Int -> IO Connection) Create a TLS proxy connection. Default behavior: throw an exception that TLS is not supported. Since 0.2.2 managerResponseTimeout :: ResponseTimeout Default timeout to be applied to requests which do not provide a timeout value. Default is 30 seconds Since: 0.5.0 managerRetryableException :: SomeException -> Bool Exceptions for which we should retry our request if we were reusing an already open connection. In the case of IOExceptions, for example, we assume that the connection was closed on the server and therefore open a new one. Since 0.1.0 managerWrapException :: forall a. Request -> IO a -> IO a Action wrapped around all attempted `Request`s, usually used to wrap up exceptions in library-specific types. Default: wrap all `IOException`s in the `InternalException` constructor. Since: 0.5.0 managerIdleConnectionCount :: Int Total number of idle connection to keep open at a given time. This limit helps deal with the case where you are making a large number of connections to different hosts. Without this limit, you could run out of file descriptors. Additionally, it can be set to zero to prevent reuse of any connections. Doing this is useful when the server your application is talking to sits behind a load balancer. Default: 512 Since 0.3.7 managerModifyRequest :: Request -> IO Request Perform the given modification to a `Request` before performing it. This function may be called more than once during request processing. see https://github.com/snoyberg/http-client/issues/350 Default: no modification Since 0.4.4 managerModifyResponse :: Response BodyReader -> IO (Response BodyReader) Perform the given modification to a `Response` after receiving it. Default: no modification Since: 0.5.5 managerProxyInsecure :: ProxyOverride How HTTP proxy server settings should be discovered. Default: respect the `proxy` value on the `Request` itself. Since 0.4.7 managerProxySecure :: ProxyOverride How HTTPS proxy server settings should be discovered. Default: respect the `proxy` value on the `Request` itself. Since 0.4.7 managerMaxHeaderLength :: Maybe MaxHeaderLength Configure the maximum size, in bytes, of an HTTP header field. Default: 4096 Since: 0.7.17 managerMaxNumberHeaders :: Maybe MaxNumberHeaders Configure the maximum number of HTTP header fields. Default: 100 Since: 0.7.18

defaultManagerSettings :: ManagerSettings #

Default value for `ManagerSettings`.

Note that this value does not have support for SSL/TLS. If you need to make any https connections, please use the http-client-tls package, which provides a `tlsManagerSettings` value.

Since 0.1.0

proxyFromRequest :: ProxyOverride #

Get the proxy settings from the `Request` itself.

Since 0.4.7

noProxy :: ProxyOverride #

Never connect using a proxy, regardless of the proxy value in the `Request`.

Since 0.4.7

useProxy :: Proxy -> ProxyOverride #

Use the given proxy settings, regardless of the proxy value in the `Request`.

Since 0.4.7

useProxySecureWithoutConnect :: Proxy -> ProxyOverride #

Send secure requests to the proxy in plain text rather than using CONNECT, regardless of the value in the `Request`.

Since: 0.7.2

proxyEnvironment #

Arguments

:: Maybe Proxy | fallback if no environment set
-> ProxyOverride |

Get the proxy settings from the default environment variable (`http_proxy` for insecure, `https_proxy` for secure). If no variable is set, then fall back to the given value. `Nothing` is equivalent to `noProxy`, `Just` is equivalent to `useProxy`.

Since 0.4.7

proxyEnvironmentNamed #

Arguments

:: Text | environment variable name
-> Maybe Proxy | fallback if no environment set
-> ProxyOverride |

Same as `proxyEnvironment`, but instead of default environment variable names, allows you to set your own name.

Since 0.4.7

defaultProxy :: ProxyOverride #

The default proxy settings for a manager. In particular: if the `http_proxy` (or `https_proxy`) environment variable is set, use it. Otherwise, use the values in the `Request`.

Since 0.4.7

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

A value for the `managerRawConnection` setting, but also allows you to modify the underlying `Socket` to set additional settings. For a motivating use case, see: https://github.com/snoyberg/http-client/issues/71.

Since 0.3.8

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

Same as `rawConnectionModifySocket`, but also takes in a chunk size.

Since: 0.5.2

getConn :: Request -> Manager -> IO (Managed Connection) #

dropProxyAuthSecure :: Request -> Request #

Drop the Proxy-Authorization header from the request if we're using a secure proxy.

# All types

data NonEmptyList a #

Constructors

One a UTCTime |
Cons a Int UTCTime (NonEmptyList a) |

data Proxy #

Define a HTTP proxy, consisting of a hostname and port number.

Constructors

Proxy |
Fields proxyHost :: ByteString The host name of the HTTP proxy in URI format. IPv6 addresses in square brackets. proxyPort :: Int The port number of the HTTP proxy.

#### Instances

Instances details

Read Proxy # |
Instance details Defined in Network.HTTP.Client.Types Methods readsPrec :: Int -> ReadS Proxy # readList :: ReadS [Proxy] # readPrec :: ReadPrec Proxy # readListPrec :: ReadPrec [Proxy] #
Show Proxy # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> Proxy -> ShowS # show :: Proxy -> String # showList :: [Proxy] -> ShowS #
Eq Proxy # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: Proxy -> Proxy -> Bool # (/=) :: Proxy -> Proxy -> Bool #
Ord Proxy # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: Proxy -> Proxy -> Ordering # (<) :: Proxy -> Proxy -> Bool # (<=) :: Proxy -> Proxy -> Bool # (>) :: Proxy -> Proxy -> Bool # (>=) :: Proxy -> Proxy -> Bool # max :: Proxy -> Proxy -> Proxy # min :: Proxy -> Proxy -> Proxy #

data Request #

All information on how to connect to a host and what should be sent in the HTTP request.

If you simply wish to download from a URL, see `parseRequest`.

The constructor for this data type is not exposed. Instead, you should use either the `defaultRequest` value, or `parseRequest` to construct from a URL, and then use the records below to make modifications. This approach allows http-client to add configuration options without breaking backwards compatibility.

For example, to construct a POST request, you could do something like:

    initReq <- parseRequest "http://www.example.com/path"
    let req = initReq
                { method = "POST"
                }

For more information, please see http://www.yesodweb.com/book/settings-types.

Since 0.1.0

Constructors

Request |
Fields method :: Method HTTP request method, eg GET, POST. Since 0.1.0 secure :: Bool Whether to use HTTPS (ie, SSL). Since 0.1.0 host :: ByteString Requested host name, used for both the IP address to connect to and the `host` request header. This is in URI format, with raw IPv6 addresses enclosed in square brackets. Use `strippedHostName` when making network connections. Since 0.1.0 port :: Int The port to connect to. Also used for generating the `host` request header. Since 0.1.0 path :: ByteString Everything from the host to the query string. Since 0.1.0 queryString :: ByteString Query string appended to the path. Since 0.1.0 requestHeaders :: RequestHeaders Custom HTTP request headers The Content-Length and Transfer-Encoding headers are set automatically by this module, and shall not be added to `requestHeaders`. If not provided by the user, `Host` will automatically be set based on the `host` and `port` fields. Moreover, the Accept-Encoding header is set implicitly to gzip for convenience by default. This behaviour can be overridden if needed, by setting the header explicitly to a different value. In order to omit the Accept-Header altogether, set it to the empty string "". If you need an empty Accept-Header (i.e. requesting the identity encoding), set it to a non-empty white-space string, e.g. " ". See RFC 2616 section 14.3 for details about the semantics of the Accept-Header field. If you request a content-encoding not supported by this module, you will have to decode it yourself (see also the `decompress` field). Note: Multiple header fields with the same field-name will result in multiple header fields being sent and therefore it's the responsibility of the client code to ensure that the rules from RFC 2616 section 4.2 are honoured. Since 0.1.0 requestBody :: RequestBody Request body to be sent to the server. Since 0.1.0 proxy :: Maybe Proxy Optional HTTP proxy. Since 0.1.0 hostAddress :: Maybe HostAddress Optional resolved host address. May not be used by all backends. Since 0.1.0 rawBody :: Bool If `True`, a chunked and/or gzipped body will not be decoded. Use with caution. Since 0.1.0 decompress :: ByteString -> Bool Predicate to specify whether gzipped data should be decompressed on the fly (see `alwaysDecompress` and `browserDecompress`). Argument is the mime type. Default: browserDecompress. Since 0.1.0 redirectCount :: Int How many redirects to follow when getting a resource. 0 means follow no redirects. Default value: 10. Since 0.1.0 checkResponse :: Request -> Response BodyReader -> IO () Check the response immediately after receiving the status and headers. This can be useful for throwing exceptions on non-success status codes. In previous versions of http-client, this went under the name `checkStatus`, but was renamed to avoid confusion about the new default behavior (doing nothing). Since: 0.5.0 responseTimeout :: ResponseTimeout Number of microseconds to wait for a response (see `ResponseTimeout` for more information). Default: use `managerResponseTimeout` (which by default is 30 seconds). Since 0.1.0 cookieJar :: Maybe CookieJar A user-defined cookie jar. If `Nothing`, no cookie handling will take place, "Cookie" headers in `requestHeaders` will be sent raw, and `responseCookieJar` will be empty. Since 0.1.0 requestVersion :: HttpVersion HTTP version to send to server. Default: HTTP 1.1 Since 0.4.3 onRequestBodyException :: SomeException -> IO () How to deal with exceptions thrown while sending the request. Default: ignore `IOException`s, rethrow all other exceptions. Since: 0.4.6 requestManagerOverride :: Maybe Manager A `Manager` value that should override whatever `Manager` value was passed in to the HTTP request function manually. This is useful when dealing with implicit global managers, such as in `Network.HTTP.Simple` Since: 0.4.28 shouldStripHeaderOnRedirect :: HeaderName -> Bool Decide whether a header must be stripped from the request when following a redirect. Default: keep all headers intact. Since: 0.6.2 shouldStripHeaderOnRedirectIfOnDifferentHostOnly :: Bool Decide whether a header must be stripped from the request when following a redirect, if host differs from previous request in redirect chain. Default: false (always strip regardless of host change) Since: 0.7.15 proxySecureMode :: ProxySecureMode How to proxy an HTTPS request. Default: Use HTTP CONNECT. Since: 0.7.2 redactHeaders :: Set HeaderName List of header values being redacted in case we show Request. Since: 0.7.13 earlyHintHeadersReceived :: [Header] -> IO () Called every time an HTTP 103 Early Hints header section is received from the server. Since: 0.7.16

#### Instances

Instances details

IsString Request # | Parses a URL via `parseRequest_` NOTE: Prior to version 0.5.0, this instance used `parseUrlThrow` instead.
Instance details Defined in Network.HTTP.Client.Request Methods fromString :: String -> Request #
Show Request # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> Request -> ShowS # show :: Request -> String # showList :: [Request] -> ShowS #

data ConnHost #

Hostname or resolved host address.

Constructors

HostName Text |
HostAddress HostAddress |

#### Instances

Instances details

Show ConnHost # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> ConnHost -> ShowS # show :: ConnHost -> String # showList :: [ConnHost] -> ShowS #
Eq ConnHost # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: ConnHost -> ConnHost -> Bool # (/=) :: ConnHost -> ConnHost -> Bool #
Ord ConnHost # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: ConnHost -> ConnHost -> Ordering # (<) :: ConnHost -> ConnHost -> Bool # (<=) :: ConnHost -> ConnHost -> Bool # (>) :: ConnHost -> ConnHost -> Bool # (>=) :: ConnHost -> ConnHost -> Bool # max :: ConnHost -> ConnHost -> ConnHost # min :: ConnHost -> ConnHost -> ConnHost #

type Popper = IO ByteString #

A function which generates successive chunks of a request body, provider a single empty bytestring when no more data is available.

Since 0.1.0

data StreamFileStatus #

Status of streaming a request body from a file.

Since 0.4.9

Constructors

StreamFileStatus |
Fields fileSize :: Int64 readSoFar :: Int64 thisChunkSize :: Int

#### Instances

Instances details

Show StreamFileStatus # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> StreamFileStatus -> ShowS # show :: StreamFileStatus -> String # showList :: [StreamFileStatus] -> ShowS #
Eq StreamFileStatus # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: StreamFileStatus -> StreamFileStatus -> Bool # (/=) :: StreamFileStatus -> StreamFileStatus -> Bool #
Ord StreamFileStatus # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: StreamFileStatus -> StreamFileStatus -> Ordering # (<) :: StreamFileStatus -> StreamFileStatus -> Bool # (<=) :: StreamFileStatus -> StreamFileStatus -> Bool # (>) :: StreamFileStatus -> StreamFileStatus -> Bool # (>=) :: StreamFileStatus -> StreamFileStatus -> Bool # max :: StreamFileStatus -> StreamFileStatus -> StreamFileStatus # min :: StreamFileStatus -> StreamFileStatus -> StreamFileStatus #

data Manager #

Keeps track of open connections for keep-alive.

If possible, you should share a single `Manager` between multiple threads and requests.

Since 0.1.0

Constructors

Manager |
Fields mConns :: KeyedPool ConnKey Connection mResponseTimeout :: ResponseTimeout Copied from `managerResponseTimeout` mRetryableException :: SomeException -> Bool mWrapException :: forall a. Request -> IO a -> IO a mModifyRequest :: Request -> IO Request mSetProxy :: Request -> Request mModifyResponse :: Response BodyReader -> IO (Response BodyReader) See `managerProxy` mMaxHeaderLength :: Maybe MaxHeaderLength mMaxNumberHeaders :: Maybe MaxNumberHeaders

#### Instances

Instances details

HasHttpManager Manager # |
Instance details Defined in Network.HTTP.Client.Types Methods getHttpManager :: Manager -> Manager #

class HasHttpManager a where #

Methods

getHttpManager :: a -> Manager #

#### Instances

Instances details

HasHttpManager Manager # |
Instance details Defined in Network.HTTP.Client.Types Methods getHttpManager :: Manager -> Manager #

data ManagerSettings #

Settings for a `Manager`. Please use the `defaultManagerSettings` function and then modify individual settings. For more information, see http://www.yesodweb.com/book/settings-types.

Since 0.1.0

Constructors

ManagerSettings |
Fields managerConnCount :: Int Number of connections to a single host to keep alive. Default: 10. Since 0.1.0 managerRawConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection) Create an insecure connection. Since 0.1.0 managerTlsConnection :: IO (Maybe HostAddress -> String -> Int -> IO Connection) Create a TLS connection. Default behavior: throw an exception that TLS is not supported. Since 0.1.0 managerTlsProxyConnection :: IO (ByteString -> (Connection -> IO ()) -> String -> Maybe HostAddress -> String -> Int -> IO Connection) Create a TLS proxy connection. Default behavior: throw an exception that TLS is not supported. Since 0.2.2 managerResponseTimeout :: ResponseTimeout Default timeout to be applied to requests which do not provide a timeout value. Default is 30 seconds Since: 0.5.0 managerRetryableException :: SomeException -> Bool Exceptions for which we should retry our request if we were reusing an already open connection. In the case of IOExceptions, for example, we assume that the connection was closed on the server and therefore open a new one. Since 0.1.0 managerWrapException :: forall a. Request -> IO a -> IO a Action wrapped around all attempted `Request`s, usually used to wrap up exceptions in library-specific types. Default: wrap all `IOException`s in the `InternalException` constructor. Since: 0.5.0 managerIdleConnectionCount :: Int Total number of idle connection to keep open at a given time. This limit helps deal with the case where you are making a large number of connections to different hosts. Without this limit, you could run out of file descriptors. Additionally, it can be set to zero to prevent reuse of any connections. Doing this is useful when the server your application is talking to sits behind a load balancer. Default: 512 Since 0.3.7 managerModifyRequest :: Request -> IO Request Perform the given modification to a `Request` before performing it. This function may be called more than once during request processing. see https://github.com/snoyberg/http-client/issues/350 Default: no modification Since 0.4.4 managerModifyResponse :: Response BodyReader -> IO (Response BodyReader) Perform the given modification to a `Response` after receiving it. Default: no modification Since: 0.5.5 managerProxyInsecure :: ProxyOverride How HTTP proxy server settings should be discovered. Default: respect the `proxy` value on the `Request` itself. Since 0.4.7 managerProxySecure :: ProxyOverride How HTTPS proxy server settings should be discovered. Default: respect the `proxy` value on the `Request` itself. Since 0.4.7 managerMaxHeaderLength :: Maybe MaxHeaderLength Configure the maximum size, in bytes, of an HTTP header field. Default: 4096 Since: 0.7.17 managerMaxNumberHeaders :: Maybe MaxNumberHeaders Configure the maximum number of HTTP header fields. Default: 100 Since: 0.7.18

newtype ProxyOverride #

How the HTTP proxy server settings should be discovered.

Since 0.4.7

Constructors

ProxyOverride |
Fields runProxyOverride :: Bool -> IO (Request -> Request)

data ResponseTimeout #

How to deal with timing out on retrieval of response headers.

Since: 0.5.0

Constructors

ResponseTimeoutMicro !Int | Wait the given number of microseconds for response headers to load, then throw an exception
ResponseTimeoutNone | Wait indefinitely
ResponseTimeoutDefault | Fall back to the manager setting (`managerResponseTimeout`) or, in its absence, Wait 30 seconds and then throw an exception.

#### Instances

Instances details

Show ResponseTimeout # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> ResponseTimeout -> ShowS # show :: ResponseTimeout -> String # showList :: [ResponseTimeout] -> ShowS #
Eq ResponseTimeout # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: ResponseTimeout -> ResponseTimeout -> Bool # (/=) :: ResponseTimeout -> ResponseTimeout -> Bool #

data HttpExceptionContent #

Constructors

StatusCodeException (Response ()) ByteString | Generated by the `parseUrlThrow` function when the server returns a non-2XX response status code. May include the beginning of the response body. Since: 0.5.0
TooManyRedirects [Response ByteString] | The server responded with too many redirects for a request. Contains the list of encountered responses containing redirects in reverse chronological order; including last redirect, which triggered the exception and was not followed. Since: 0.5.0
OverlongHeaders | Too many total bytes in the HTTP header were returned by the server. Since: 0.5.0
TooManyHeaderFields | Too many HTTP header fields were returned by the server. Since: 0.7.18
ResponseTimeout | The server took too long to return a response. This can be altered via `responseTimeout` or `managerResponseTimeout`. Since: 0.5.0
ConnectionTimeout | Attempting to connect to the server timed out. Since: 0.5.0
ConnectionFailure SomeException | An exception occurred when trying to connect to the server. Since: 0.5.0
InvalidStatusLine ByteString | The status line returned by the server could not be parsed. Since: 0.5.0
InvalidHeader ByteString | The given response header line could not be parsed Since: 0.5.0
InvalidRequestHeader ByteString | The given request header is not compliant (e.g. has newlines) Since: 0.5.14
InternalException SomeException | An exception was raised by an underlying library when performing the request. Most often, this is caused by a failing socket action or a TLS exception. Since: 0.5.0
ProxyConnectException ByteString Int Status | A non-200 status code was returned when trying to connect to the proxy server on the given host and port. Since: 0.5.0
NoResponseDataReceived | No response data was received from the server at all. This exception may deserve special handling within the library, since it may indicate that a pipelining has been used, and a connection thought to be open was in fact closed. Since: 0.5.0
TlsNotSupported | Exception thrown when using a `Manager` which does not have support for secure connections. Typically, you will want to use `tlsManagerSettings` from `http-client-tls` to overcome this. Since: 0.5.0
WrongRequestBodyStreamSize Word64 Word64 | The request body provided did not match the expected size. Provides the expected and actual size. Since: 0.4.31
ResponseBodyTooShort Word64 Word64 | The returned response body is too short. Provides the expected size and actual size. Since: 0.5.0
InvalidChunkHeaders | A chunked response body had invalid headers. Since: 0.5.0
IncompleteHeaders | An incomplete set of response headers were returned. Since: 0.5.0
InvalidDestinationHost ByteString | The host we tried to connect to is invalid (e.g., an empty string).
HttpZlibException ZlibException | An exception was thrown when inflating a response body. Since: 0.5.0
InvalidProxyEnvironmentVariable Text Text | Values in the proxy environment variable were invalid. Provides the environment variable name and its value. Since: 0.5.0
ConnectionClosed | Attempted to use a `Connection` which was already closed Since: 0.5.0
InvalidProxySettings Text | Proxy settings are not valid (Windows specific currently) @since 0.5.7

#### Instances

Instances details

Show HttpExceptionContent # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> HttpExceptionContent -> ShowS # show :: HttpExceptionContent -> String # showList :: [HttpExceptionContent] -> ShowS #

data RequestBody #

When using one of the `RequestBodyStream` / `RequestBodyStreamChunked` constructors, you must ensure that the `GivesPopper` can be called multiple times. Usually this is not a problem.

The `RequestBodyStreamChunked` will send a chunked request body. Note that not all servers support this. Only use `RequestBodyStreamChunked` if you know the server you're sending to supports chunked request bodies.

Since 0.1.0

Constructors

RequestBodyLBS ByteString |
RequestBodyBS ByteString |
RequestBodyBuilder Int64 Builder |
RequestBodyStream Int64 (GivesPopper ()) |
RequestBodyStreamChunked (GivesPopper ()) |
RequestBodyIO (IO RequestBody) | Allows creation of a `RequestBody` inside the `IO` monad, which is useful for making easier APIs (like `setRequestBodyFile`). Since: 0.4.28

#### Instances

Instances details

Monoid RequestBody # |
Instance details Defined in Network.HTTP.Client.Types Methods mempty :: RequestBody # mappend :: RequestBody -> RequestBody -> RequestBody # mconcat :: [RequestBody] -> RequestBody #
Semigroup RequestBody # |
Instance details Defined in Network.HTTP.Client.Types Methods (<>) :: RequestBody -> RequestBody -> RequestBody # sconcat :: NonEmpty RequestBody -> RequestBody # stimes :: Integral b => b -> RequestBody -> RequestBody #
IsString RequestBody # | Since 0.4.12
Instance details Defined in Network.HTTP.Client.Types Methods fromString :: String -> RequestBody #

type NeedsPopper a = Popper -> IO a #

A function which must be provided with a `Popper`.

Since 0.1.0

type GivesPopper a = NeedsPopper a -> IO a #

A function which will provide a `Popper` to a `NeedsPopper`. This seemingly convoluted structure allows for creation of request bodies which allocate scarce resources in an exception safe manner.

Since 0.1.0

data Response body #

A simple representation of the HTTP response.

Since 0.1.0

Constructors

Response |
Fields responseStatus :: Status Status code of the response. Since 0.1.0 responseVersion :: HttpVersion HTTP version used by the server. Since 0.1.0 responseHeaders :: ResponseHeaders Response headers sent by the server. Since 0.1.0 responseBody :: body Response body sent by the server. Since 0.1.0 responseCookieJar :: CookieJar Cookies set on the client after interacting with the server. If cookies have been disabled by setting `cookieJar` to `Nothing`, then this will always be empty. Since 0.1.0 responseClose' :: ResponseClose Releases any resource held by this response. If the response body has not been fully read yet, doing so after this call will likely be impossible. Since 0.1.0 responseOriginalRequest :: Request Holds original `Request` related to this `Response` (with an empty body). This field is intentionally not exported directly, but made available via `getOriginalRequest` instead. Since 0.7.8 responseEarlyHints :: ResponseHeaders Early response headers sent by the server, as part of an HTTP 103 Early Hints section. Since 0.7.16

#### Instances

Instances details

Functor Response # |
Instance details Defined in Network.HTTP.Client.Types Methods fmap :: (a -> b) -> Response a -> Response b # (<$) :: a -> Response b -> Response a #
Foldable Response # |
Instance details Defined in Network.HTTP.Client.Types Methods fold :: Monoid m => Response m -> m # foldMap :: Monoid m => (a -> m) -> Response a -> m # foldMap' :: Monoid m => (a -> m) -> Response a -> m # foldr :: (a -> b -> b) -> b -> Response a -> b # foldr' :: (a -> b -> b) -> b -> Response a -> b # foldl :: (b -> a -> b) -> b -> Response a -> b # foldl' :: (b -> a -> b) -> b -> Response a -> b # foldr1 :: (a -> a -> a) -> Response a -> a # foldl1 :: (a -> a -> a) -> Response a -> a # toList :: Response a -> [a] # null :: Response a -> Bool # length :: Response a -> Int # elem :: Eq a => a -> Response a -> Bool # maximum :: Ord a => Response a -> a # minimum :: Ord a => Response a -> a # sum :: Num a => Response a -> a # product :: Num a => Response a -> a #
Traversable Response # |
Instance details Defined in Network.HTTP.Client.Types Methods traverse :: Applicative f => (a -> f b) -> Response a -> f (Response b) # sequenceA :: Applicative f => Response (f a) -> f (Response a) # mapM :: Monad m => (a -> m b) -> Response a -> m (Response b) # sequence :: Monad m => Response (m a) -> m (Response a) #
Show body => Show (Response body) # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> Response body -> ShowS # show :: Response body -> String # showList :: [Response body] -> ShowS #

type BodyReader = IO ByteString #

An `IO` action that represents an incoming response body coming from the server. Data provided by this action has already been gunzipped and de-chunked, and respects any content-length headers present.

The action gets a single chunk of data from the response body, or an empty bytestring if no more data is available.

Since 0.4.0

data HttpException #

An exception which may be generated by this library

Since: 0.5.0

Constructors

HttpExceptionRequest Request HttpExceptionContent | Most exceptions are specific to a `Request`. Inspect the `HttpExceptionContent` value for details on what occurred. Since: 0.5.0
InvalidUrlException String String | A URL (first field) is invalid for a given reason (second argument). Since: 0.5.0

#### Instances

Instances details

Exception HttpException # |
Instance details Defined in Network.HTTP.Client.Types Methods toException :: HttpException -> SomeException # fromException :: SomeException -> Maybe HttpException # displayException :: HttpException -> String # backtraceDesired :: HttpException -> Bool #
Show HttpException # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> HttpException -> ShowS # show :: HttpException -> String # showList :: [HttpException] -> ShowS #

data Cookie #

Constructors

Cookie |
Fields cookie_name :: ByteString cookie_value :: ByteString cookie_expiry_time :: UTCTime cookie_domain :: ByteString cookie_path :: ByteString cookie_creation_time :: UTCTime cookie_last_access_time :: UTCTime cookie_persistent :: Bool cookie_host_only :: Bool cookie_secure_only :: Bool cookie_http_only :: Bool

#### Instances

Instances details

Read Cookie # |
Instance details Defined in Network.HTTP.Client.Types Methods readsPrec :: Int -> ReadS Cookie # readList :: ReadS [Cookie] # readPrec :: ReadPrec Cookie # readListPrec :: ReadPrec [Cookie] #
Show Cookie # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> Cookie -> ShowS # show :: Cookie -> String # showList :: [Cookie] -> ShowS #

equalCookie :: Cookie -> Cookie -> Bool #

Instead of `(==)`.

Since there was some confusion in the history of this library about how the `Eq` instance should work, it was removed for clarity, and replaced by `equal` and `equiv`. `equal` gives you equality of all fields of the `Cookie` record.

Since: 0.7.0

equivCookie :: Cookie -> Cookie -> Bool #

Equality of name, domain, path only. This corresponds to step 11 of the algorithm described in Section 5.3 "Storage Model". See also: `equal`.

Since: 0.7.0

compareCookies :: Cookie -> Cookie -> Ordering #

Instead of `instance Ord Cookie`. See `equalCookie`, `equivCookie`.

Since: 0.7.0

newtype CookieJar #

Constructors

CJ |
Fields expose :: [Cookie]

#### Instances

Instances details

Monoid CookieJar # | Since 1.9
Instance details Defined in Network.HTTP.Client.Types Methods mempty :: CookieJar # mappend :: CookieJar -> CookieJar -> CookieJar # mconcat :: [CookieJar] -> CookieJar #
Semigroup CookieJar # |
Instance details Defined in Network.HTTP.Client.Types Methods (<>) :: CookieJar -> CookieJar -> CookieJar # sconcat :: NonEmpty CookieJar -> CookieJar # stimes :: Integral b => b -> CookieJar -> CookieJar #
Read CookieJar # |
Instance details Defined in Network.HTTP.Client.Types Methods readsPrec :: Int -> ReadS CookieJar # readList :: ReadS [CookieJar] # readPrec :: ReadPrec CookieJar # readListPrec :: ReadPrec [CookieJar] #
Show CookieJar # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> CookieJar -> ShowS # show :: CookieJar -> String # showList :: [CookieJar] -> ShowS #

equalCookieJar :: CookieJar -> CookieJar -> Bool #

See `equalCookie`.

Since: 0.7.0

equivCookieJar :: CookieJar -> CookieJar -> Bool #

See `equalCookieJar`, `equalCookie`.

Since: 0.7.0

data Connection #

Constructors

Connection |
Fields connectionRead :: IO ByteString If no more data, return empty. connectionUnread :: ByteString -> IO () Return data to be read next time. connectionWrite :: ByteString -> IO () Send data to server connectionClose :: IO () Close connection. Any successive operation on the connection (except closing) should fail with `ConnectionClosed` exception. It is allowed to close connection multiple times.

data StatusHeaders #

Constructors

StatusHeaders Status HttpVersion RequestHeaders RequestHeaders |

#### Instances

Instances details

Show StatusHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> StatusHeaders -> ShowS # show :: StatusHeaders -> String # showList :: [StatusHeaders] -> ShowS #
Eq StatusHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: StatusHeaders -> StatusHeaders -> Bool # (/=) :: StatusHeaders -> StatusHeaders -> Bool #
Ord StatusHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: StatusHeaders -> StatusHeaders -> Ordering # (<) :: StatusHeaders -> StatusHeaders -> Bool # (<=) :: StatusHeaders -> StatusHeaders -> Bool # (>) :: StatusHeaders -> StatusHeaders -> Bool # (>=) :: StatusHeaders -> StatusHeaders -> Bool # max :: StatusHeaders -> StatusHeaders -> StatusHeaders # min :: StatusHeaders -> StatusHeaders -> StatusHeaders #

unHttpExceptionContentWrapper :: HttpExceptionContentWrapper -> HttpExceptionContent #

throwHttp :: HttpExceptionContent -> IO a #

toHttpException :: Request -> HttpExceptionContentWrapper -> HttpException #

newtype ResponseClose #

Constructors

ResponseClose |
Fields runResponseClose :: IO ()

#### Instances

Instances details

Show ResponseClose # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> ResponseClose -> ShowS # show :: ResponseClose -> String # showList :: [ResponseClose] -> ShowS #

data ConnsMap #

Constructors

ManagerClosed |
ManagerOpen !Int !(Map ConnKey (NonEmptyList Connection)) |

data ConnKey #

`ConnKey` consists of a hostname, a port and a `Bool` specifying whether to use SSL.

Constructors

CKRaw (Maybe HostAddress) !ByteString !Int |
CKSecure (Maybe HostAddress) !ByteString !Int |
CKProxy !ByteString !Int (Maybe ByteString) !ByteString !Int |

#### Instances

Instances details

Show ConnKey # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> ConnKey -> ShowS # show :: ConnKey -> String # showList :: [ConnKey] -> ShowS #
Eq ConnKey # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: ConnKey -> ConnKey -> Bool # (/=) :: ConnKey -> ConnKey -> Bool #
Ord ConnKey # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: ConnKey -> ConnKey -> Ordering # (<) :: ConnKey -> ConnKey -> Bool # (<=) :: ConnKey -> ConnKey -> Bool # (>) :: ConnKey -> ConnKey -> Bool # (>=) :: ConnKey -> ConnKey -> Bool # max :: ConnKey -> ConnKey -> ConnKey # min :: ConnKey -> ConnKey -> ConnKey #

data ProxySecureMode #

Define how to make secure connections using a proxy server.

Constructors

ProxySecureWithConnect | Use the HTTP CONNECT verb to forward a secure connection through the proxy.
ProxySecureWithoutConnect | Send the request directly to the proxy with an https URL. This mode can be used to offload TLS handling to a trusted local proxy.

#### Instances

Instances details

Read ProxySecureMode # |
Instance details Defined in Network.HTTP.Client.Types Methods readsPrec :: Int -> ReadS ProxySecureMode # readList :: ReadS [ProxySecureMode] # readPrec :: ReadPrec ProxySecureMode # readListPrec :: ReadPrec [ProxySecureMode] #
Show ProxySecureMode # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> ProxySecureMode -> ShowS # show :: ProxySecureMode -> String # showList :: [ProxySecureMode] -> ShowS #
Eq ProxySecureMode # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: ProxySecureMode -> ProxySecureMode -> Bool # (/=) :: ProxySecureMode -> ProxySecureMode -> Bool #
Ord ProxySecureMode # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: ProxySecureMode -> ProxySecureMode -> Ordering # (<) :: ProxySecureMode -> ProxySecureMode -> Bool # (<=) :: ProxySecureMode -> ProxySecureMode -> Bool # (>) :: ProxySecureMode -> ProxySecureMode -> Bool # (>=) :: ProxySecureMode -> ProxySecureMode -> Bool # max :: ProxySecureMode -> ProxySecureMode -> ProxySecureMode # min :: ProxySecureMode -> ProxySecureMode -> ProxySecureMode #

newtype MaxHeaderLength #

The maximum header size in bytes.

Since: 0.7.14

Constructors

MaxHeaderLength |
Fields unMaxHeaderLength :: Int

#### Instances

Instances details

Bounded MaxHeaderLength # |
Instance details Defined in Network.HTTP.Client.Types Methods minBound :: MaxHeaderLength # maxBound :: MaxHeaderLength #
Enum MaxHeaderLength # |
Instance details Defined in Network.HTTP.Client.Types Methods succ :: MaxHeaderLength -> MaxHeaderLength # pred :: MaxHeaderLength -> MaxHeaderLength # toEnum :: Int -> MaxHeaderLength # fromEnum :: MaxHeaderLength -> Int # enumFrom :: MaxHeaderLength -> [MaxHeaderLength] # enumFromThen :: MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength] # enumFromTo :: MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength] # enumFromThenTo :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength -> [MaxHeaderLength] #
Num MaxHeaderLength # |
Instance details Defined in Network.HTTP.Client.Types Methods (+) :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength # (-) :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength # (*) :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength # negate :: MaxHeaderLength -> MaxHeaderLength # abs :: MaxHeaderLength -> MaxHeaderLength # signum :: MaxHeaderLength -> MaxHeaderLength # fromInteger :: Integer -> MaxHeaderLength #
Show MaxHeaderLength # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> MaxHeaderLength -> ShowS # show :: MaxHeaderLength -> String # showList :: [MaxHeaderLength] -> ShowS #
Eq MaxHeaderLength # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: MaxHeaderLength -> MaxHeaderLength -> Bool # (/=) :: MaxHeaderLength -> MaxHeaderLength -> Bool #
Ord MaxHeaderLength # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: MaxHeaderLength -> MaxHeaderLength -> Ordering # (<) :: MaxHeaderLength -> MaxHeaderLength -> Bool # (<=) :: MaxHeaderLength -> MaxHeaderLength -> Bool # (>) :: MaxHeaderLength -> MaxHeaderLength -> Bool # (>=) :: MaxHeaderLength -> MaxHeaderLength -> Bool # max :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength # min :: MaxHeaderLength -> MaxHeaderLength -> MaxHeaderLength #

newtype MaxNumberHeaders #

The maximum number of header fields.

Since: 0.7.18

Constructors

MaxNumberHeaders |
Fields unMaxNumberHeaders :: Int

#### Instances

Instances details

Bounded MaxNumberHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods minBound :: MaxNumberHeaders # maxBound :: MaxNumberHeaders #
Enum MaxNumberHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods succ :: MaxNumberHeaders -> MaxNumberHeaders # pred :: MaxNumberHeaders -> MaxNumberHeaders # toEnum :: Int -> MaxNumberHeaders # fromEnum :: MaxNumberHeaders -> Int # enumFrom :: MaxNumberHeaders -> [MaxNumberHeaders] # enumFromThen :: MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders] # enumFromTo :: MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders] # enumFromThenTo :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders -> [MaxNumberHeaders] #
Num MaxNumberHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods (+) :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders # (-) :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders # (*) :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders # negate :: MaxNumberHeaders -> MaxNumberHeaders # abs :: MaxNumberHeaders -> MaxNumberHeaders # signum :: MaxNumberHeaders -> MaxNumberHeaders # fromInteger :: Integer -> MaxNumberHeaders #
Show MaxNumberHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods showsPrec :: Int -> MaxNumberHeaders -> ShowS # show :: MaxNumberHeaders -> String # showList :: [MaxNumberHeaders] -> ShowS #
Eq MaxNumberHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods (==) :: MaxNumberHeaders -> MaxNumberHeaders -> Bool # (/=) :: MaxNumberHeaders -> MaxNumberHeaders -> Bool #
Ord MaxNumberHeaders # |
Instance details Defined in Network.HTTP.Client.Types Methods compare :: MaxNumberHeaders -> MaxNumberHeaders -> Ordering # (<) :: MaxNumberHeaders -> MaxNumberHeaders -> Bool # (<=) :: MaxNumberHeaders -> MaxNumberHeaders -> Bool # (>) :: MaxNumberHeaders -> MaxNumberHeaders -> Bool # (>=) :: MaxNumberHeaders -> MaxNumberHeaders -> Bool # max :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders # min :: MaxNumberHeaders -> MaxNumberHeaders -> MaxNumberHeaders #

# Various utilities

readPositiveInt :: String -> Maybe Int #

Read a positive `Int`, accounting for overflow

dummyManaged :: resource -> Managed resource #

For testing purposes only: create a dummy Managed wrapper