http-client 0.3.2.2 → 0.3.3
raw patch · 2 files changed
+54/−46 lines, 2 files
Files
- Network/HTTP/Client/Types.hs +53/−45
- http-client.cabal +1/−1
Network/HTTP/Client/Types.hs view
@@ -61,17 +61,18 @@ type BodyReader = IO S.ByteString data Connection = Connection- { connectionRead :: !(IO S.ByteString)+ { connectionRead :: IO S.ByteString -- ^ If no more data, return empty.- , connectionUnread :: !(S.ByteString -> IO ())+ , connectionUnread :: S.ByteString -> IO () -- ^ Return data to be read next time.- , connectionWrite :: !(S.ByteString -> IO ())+ , connectionWrite :: S.ByteString -> IO () -- ^ Send data to server- , connectionClose :: !(IO ())+ , connectionClose :: IO () }+ deriving T.Typeable -data StatusHeaders = StatusHeaders !Status !HttpVersion !RequestHeaders- deriving (Show, Eq, Ord)+data StatusHeaders = StatusHeaders Status HttpVersion RequestHeaders+ deriving (Show, Eq, Ord, T.Typeable) data HttpException = StatusCodeException Status ResponseHeaders CookieJar | InvalidUrlException String String@@ -124,10 +125,10 @@ , cookie_secure_only :: Bool , cookie_http_only :: Bool }- deriving (Read, Show)+ deriving (Read, Show, T.Typeable) newtype CookieJar = CJ { expose :: [Cookie] }- deriving (Read, Show)+ deriving (Read, Show, T.Typeable) -- This corresponds to step 11 of the algorithm described in Section 5.3 \"Storage Model\" instance Eq Cookie where@@ -162,8 +163,8 @@ -- | Define a HTTP proxy, consisting of a hostname and port number. data Proxy = Proxy- { proxyHost :: !S.ByteString -- ^ The host name of the HTTP proxy.- , proxyPort :: !Int -- ^ The port number of the HTTP proxy.+ { proxyHost :: S.ByteString -- ^ The host name of the HTTP proxy.+ , proxyPort :: Int -- ^ The port number of the HTTP proxy. } deriving (Show, Read, Eq, Ord, T.Typeable) @@ -177,11 +178,12 @@ -- -- Since 0.1.0 data RequestBody- = RequestBodyLBS !L.ByteString- | RequestBodyBS !S.ByteString- | RequestBodyBuilder !Int64 !Builder- | RequestBodyStream !Int64 !(GivesPopper ())- | RequestBodyStreamChunked !(GivesPopper ())+ = RequestBodyLBS L.ByteString+ | RequestBodyBS S.ByteString+ | RequestBodyBuilder Int64 Builder+ | RequestBodyStream Int64 (GivesPopper ())+ | RequestBodyStreamChunked (GivesPopper ())+ deriving T.Typeable instance Monoid RequestBody where mempty = RequestBodyBS S.empty mappend x0 y0 =@@ -361,8 +363,9 @@ -- -- Since 0.1.0 , responseTimeout :: Maybe Int- -- ^ Number of microseconds to wait for a response. If @Nothing@, will wait- -- indefinitely. Default: 5 seconds.+ -- ^ Number of microseconds to wait for a response. If+ -- @Nothing@, will wait indefinitely. Default: use+ -- 'managerResponseTimeout' (which by default is 5 seconds). -- -- Since 0.1.0 , getConnectionWrapper :: Maybe Int@@ -386,8 +389,10 @@ -- -- Since 0.1.0 }+ deriving T.Typeable data ConnReuse = Reuse | DontReuse+ deriving T.Typeable type ConnRelease = ConnReuse -> IO () @@ -397,29 +402,29 @@ -- -- Since 0.1.0 data Response body = Response- { responseStatus :: !Status+ { responseStatus :: Status -- ^ Status code of the response. -- -- Since 0.1.0- , responseVersion :: !HttpVersion+ , responseVersion :: HttpVersion -- ^ HTTP version used by the server. -- -- Since 0.1.0- , responseHeaders :: !ResponseHeaders+ , responseHeaders :: ResponseHeaders -- ^ Response headers sent by the server. -- -- Since 0.1.0- , responseBody :: !body+ , responseBody :: body -- ^ Response body sent by the server. -- -- Since 0.1.0- , responseCookieJar :: !CookieJar+ , 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+ , 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.@@ -440,38 +445,38 @@ -- -- Since 0.1.0 data ManagerSettings = ManagerSettings- { managerConnCount :: !Int+ { managerConnCount :: Int -- ^ Number of connections to a single host to keep alive. Default: 10. -- -- Since 0.1.0- , managerRawConnection :: !(IO (Maybe NS.HostAddress -> String -> Int -> IO Connection))+ , managerRawConnection :: IO (Maybe NS.HostAddress -> String -> Int -> IO Connection) -- ^ Create an insecure connection. -- -- Since 0.1.0 -- FIXME in the future, combine managerTlsConnection and managerTlsProxyConnection- , managerTlsConnection :: !(IO (Maybe NS.HostAddress -> String -> Int -> IO Connection))+ , managerTlsConnection :: IO (Maybe NS.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 (S.ByteString -> (Connection -> IO ()) -> Maybe NS.HostAddress -> String -> Int -> IO Connection))+ , managerTlsProxyConnection :: IO (S.ByteString -> (Connection -> IO ()) -> Maybe NS.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 :: !(Maybe Int)+ , managerResponseTimeout :: Maybe Int -- ^ Default timeout (in microseconds) to be applied to requests which do -- not provide a timeout value. -- -- Default is 5 seconds -- -- Since 0.1.0- , managerRetryableException :: !(SomeException -> Bool)+ , 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- , managerWrapIOException :: !(forall a. IO a -> IO a)+ , managerWrapIOException :: forall a. IO a -> IO a -- ^ Action wrapped around all attempted @Request@s, usually used to wrap -- up exceptions in library-specific types. --@@ -479,6 +484,7 @@ -- -- Since 0.1.0 }+ deriving T.Typeable -- | Keeps track of open connections for keep-alive. --@@ -486,30 +492,32 @@ -- -- Since 0.1.0 data Manager = Manager- { mConns :: !(I.IORef (Maybe (Map.Map ConnKey (NonEmptyList Connection))))+ { mConns :: I.IORef (Maybe (Map.Map ConnKey (NonEmptyList Connection))) -- ^ @Nothing@ indicates that the manager is closed.- , mMaxConns :: !Int+ , mMaxConns :: Int -- ^ This is a per-@ConnKey@ value.- , mResponseTimeout :: !(Maybe Int)+ , mResponseTimeout :: Maybe Int -- ^ Copied from 'managerResponseTimeout'- , mRawConnection :: !(Maybe NS.HostAddress -> String -> Int -> IO Connection)- , mTlsConnection :: !(Maybe NS.HostAddress -> String -> Int -> IO Connection)- , mTlsProxyConnection :: !(S.ByteString -> (Connection -> IO ()) -> Maybe NS.HostAddress -> String -> Int -> IO Connection)- , mRetryableException :: !(SomeException -> Bool)- , mWrapIOException :: !(forall a. IO a -> IO a)+ , mRawConnection :: Maybe NS.HostAddress -> String -> Int -> IO Connection+ , mTlsConnection :: Maybe NS.HostAddress -> String -> Int -> IO Connection+ , mTlsProxyConnection :: S.ByteString -> (Connection -> IO ()) -> Maybe NS.HostAddress -> String -> Int -> IO Connection+ , mRetryableException :: SomeException -> Bool+ , mWrapIOException :: forall a. IO a -> IO a }+ deriving T.Typeable data NonEmptyList a =- One !a !UTCTime |- Cons !a !Int !UTCTime !(NonEmptyList a)+ One a UTCTime |+ Cons a Int UTCTime (NonEmptyList a)+ deriving T.Typeable -- | Hostname or resolved host address. data ConnHost =- HostName !Text |- HostAddress !NS.HostAddress- deriving (Eq, Show, Ord)+ HostName Text |+ HostAddress NS.HostAddress+ deriving (Eq, Show, Ord, T.Typeable) -- | @ConnKey@ consists of a hostname, a port and a @Bool@ -- specifying whether to use SSL.-data ConnKey = ConnKey !ConnHost !Int !Bool- deriving (Eq, Show, Ord)+data ConnKey = ConnKey ConnHost Int Bool+ deriving (Eq, Show, Ord, T.Typeable)
http-client.cabal view
@@ -1,5 +1,5 @@ name: http-client-version: 0.3.2.2+version: 0.3.3 synopsis: An HTTP client engine, intended as a base layer for more user-friendly packages. description: This codebase has been refactored from http-conduit. homepage: https://github.com/snoyberg/http-client