http-conduit 1.6.0 → 1.6.0.1
raw patch · 8 files changed
+30/−8 lines, 8 filesdep ~asn1-datadep ~base64-bytestringdep ~bytestringPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
Dependency ranges changed: asn1-data, base64-bytestring, bytestring
API changes (from Hackage documentation)
+ Network.HTTP.Conduit: ResponseTimeout :: HttpException
+ Network.HTTP.Conduit: responseTimeout :: Request m -> Maybe Int
Files
- Network/HTTP/Conduit.hs +2/−1
- Network/HTTP/Conduit/Browser.hs +3/−0
- Network/HTTP/Conduit/Manager.hs +2/−0
- Network/HTTP/Conduit/Request.hs +1/−0
- Network/HTTP/Conduit/Response.hs +13/−2
- Network/HTTP/Conduit/Types.hs +4/−0
- Network/HTTP/Conduit/Util.hs +1/−1
- http-conduit.cabal +4/−4
Network/HTTP/Conduit.hs view
@@ -24,7 +24,7 @@ -- > request <- parseUrl "http://google.com/" -- > withManager $ \manager -> do -- > Response _ _ _ src <- http request manager--- > src C.$$ sinkFile "google.html"+-- > src C.$$+- sinkFile "google.html" -- -- The following headers are automatically set by this module, and should not -- be added to 'requestHeaders':@@ -89,6 +89,7 @@ , decompress , redirectCount , checkStatus+ , responseTimeout -- * Manager , Manager , newManager
Network/HTTP/Conduit/Browser.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Network.HTTP.Conduit.Browser ( BrowserState , BrowserAction@@ -33,7 +34,9 @@ import Control.Exception import qualified Control.Exception.Lifted as LE import Data.Conduit+#if !MIN_VERSION_base(4,6,0) import Prelude hiding (catch)+#endif import qualified Network.HTTP.Types as HT import Data.Time.Clock (getCurrentTime, UTCTime) import Data.CaseInsensitive (mk)
Network/HTTP/Conduit/Manager.hs view
@@ -17,7 +17,9 @@ , defaultCheckCerts ) where +#if !MIN_VERSION_base(4,6,0) import Prelude hiding (catch)+#endif import Data.Monoid (mappend) import System.IO (hClose, hFlush, IOMode(..)) import qualified Data.IORef as I
Network/HTTP/Conduit/Request.hs view
@@ -145,6 +145,7 @@ if 200 <= sci && sci < 300 then Nothing else Just $ toException $ StatusCodeException s hs+ , responseTimeout = Just 5000000 } -- | Always decompress a compressed stream.
Network/HTTP/Conduit/Response.hs view
@@ -38,6 +38,9 @@ import Data.Void (Void, absurd) +import System.Timeout.Lifted (timeout)+import Control.Monad.Trans.Control (MonadBaseControl)+ -- | 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'@@ -98,13 +101,21 @@ checkHeaderLength _ (HaveOutput _ _ o) = absurd o checkHeaderLength len (Leftover p i) = Leftover (checkHeaderLength len p) i -getResponse :: MonadResource m+getResponse :: (MonadResource m, MonadBaseControl IO m) => ConnRelease m -> Request m -> Source m S8.ByteString -> m (Response (ResumableSource m S8.ByteString)) getResponse connRelease req@(Request {..}) src1 = do- (src2, ((vbs, sc, sm), hs)) <- src1 $$+ checkHeaderLength 4096 sinkHeaders+ let timeout' =+ case responseTimeout of+ Nothing -> id+ Just useconds -> \ma -> do+ x <- timeout useconds ma+ case x of+ Nothing -> liftIO $ throwIO ResponseTimeout+ Just y -> return y+ (src2, ((vbs, sc, sm), hs)) <- timeout' $ src1 $$+ checkHeaderLength 4096 sinkHeaders let version = if vbs == "1.1" then W.http11 else W.http10 let s = W.Status sc sm let hs' = map (first CI.mk) hs
Network/HTTP/Conduit/Types.hs view
@@ -94,6 +94,9 @@ , checkStatus :: W.Status -> W.ResponseHeaders -> Maybe SomeException -- ^ Check the status code. Note that this will run after all redirects are -- performed. Default: return a @StatusCodeException@ on non-2XX responses.+ , responseTimeout :: Maybe Int+ -- ^ Number of microseconds to wait for a response. If @Nothing@, will wait+ -- indefinitely. Default: 5 seconds. } -- | When using one of the@@ -128,6 +131,7 @@ | HttpParserException String | HandshakeFailed | OverlongHeaders+ | ResponseTimeout deriving (Show, Typeable) instance Exception HttpException
Network/HTTP/Conduit/Util.hs view
@@ -15,7 +15,7 @@ import qualified Data.Text as T import qualified Data.Text.Read -#if 1+#if MIN_VERSION_base(4,3,0) import Data.ByteString (hGetSome) #else import GHC.IO.Handle.Types
http-conduit.cabal view
@@ -1,5 +1,5 @@ name: http-conduit-version: 1.6.0+version: 1.6.0.1 license: BSD3 license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -19,7 +19,7 @@ library build-depends: base >= 4 && < 5- , bytestring >= 0.9.1.4 && < 0.10+ , bytestring >= 0.9.1.4 && < 0.11 , transformers >= 0.2 && < 0.4 , failure >= 0.1 , resourcet >= 0.3 && < 0.4@@ -38,8 +38,8 @@ , containers >= 0.2 , certificate >= 1.2 && < 1.3 , case-insensitive >= 0.2- , base64-bytestring >= 0.1 && < 0.2- , asn1-data >= 0.5.1 && < 0.7+ , base64-bytestring >= 0.1 && < 1.1+ , asn1-data >= 0.5.1 && < 0.8 , data-default , text , transformers-base >= 0.4 && < 0.5