packages feed

http-conduit-downloader 1.0.31 → 1.0.32

raw patch · 2 files changed

+20/−6 lines, 2 filesdep ~http-clientdep ~http-conduitPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: http-client, http-conduit

API changes (from Hackage documentation)

- Network.HTTP.Conduit.Downloader: downloadG :: (Request -> ResourceT IO Request) -> Downloader -> String -> Maybe HostAddress -> DownloadOptions -> IO (DownloadResult)
+ Network.HTTP.Conduit.Downloader: downloadG :: (Request -> ResourceT IO Request) -> Downloader -> String -> Maybe HostAddress -> DownloadOptions -> IO DownloadResult

Files

Network/HTTP/Conduit/Downloader.hs view
@@ -346,13 +346,24 @@         let dl req firstTime = do                 r <- (timeout (dsTimeout settings * 1000000) $ C.runResourceT $ do                     r <- C.http req manager-                    mbb <- C.sealConduitT (C.responseBody r) C.$$+--                           sinkByteString (dsMaxDownloadSize settings)+                    let h = C.responseHeaders r+                        readLen = B.foldl' (\ r d -> r * 10 + ord d - ord '0') 0+                    mbb <- case lookup "Content-Length" h of+                        Just l+                            | B.all (\ c -> c >= '0' && c <= '9') l+                              && not (B.null l)+                              && readLen l > dsMaxDownloadSize settings+                            -> do+                               -- liftIO $ putStrLn "Content-Length too large"+                               return Nothing+                               -- no reason to download body+                        _ ->+                            C.sealConduitT (C.responseBody r) C.$$+-+                                sinkByteString (dsMaxDownloadSize settings) --                    liftIO $ print ("sink", mbb)                     case mbb of                         Just b -> do                             let c = C.responseStatus r-                                h = C.responseHeaders r                                 d = tryDeflate h b                             curTime <- liftIO $ getCurrentTime                             return@@ -426,7 +437,9 @@ httpExceptionToDR :: Monad m => String -> C.HttpException -> m DownloadResult httpExceptionToDR url exn = return $ case exn of     C.HttpExceptionRequest _ ec -> httpExceptionContentToDR url ec-    C.InvalidUrlException _ e -> DRError $ "Invalid URL: " ++ e+    C.InvalidUrlException _ e+        | e == "Invalid URL" -> DRError e+        | otherwise -> DRError $ "Invalid URL: " ++ e  httpExceptionContentToDR :: String -> C.HttpExceptionContent -> DownloadResult httpExceptionContentToDR url ec = case ec of@@ -440,6 +453,7 @@     C.ConnectionFailure e -> DRError $ "Connection failed: " ++ show e     C.InvalidStatusLine l -> DRError $ "Invalid HTTP status line:\n" ++ B.unpack l     C.InvalidHeader h -> DRError $ "Invalid HTTP header:\n" ++ B.unpack h+    C.InvalidRequestHeader h -> DRError $ "Invalid HTTP request header:\n" ++ B.unpack h     C.InternalException e ->         case show e of             "<<timeout>>" -> DRError "Timeout"
http-conduit-downloader.cabal view
@@ -1,6 +1,6 @@ cabal-version:  >= 1.6 name:           http-conduit-downloader-version:        1.0.31+version:        1.0.32 author:         Vladimir Shabanov <vshabanoff@gmail.com> maintainer:     Vladimir Shabanov <vshabanoff@gmail.com> homepage:       https://github.com/bazqux/http-conduit-downloader@@ -41,7 +41,7 @@  library     build-depends:-        base == 4.*, http-conduit >= 2.3.2, http-client >= 0.5.0, connection, zlib,+        base == 4.*, http-conduit >= 2.3.4, http-client >= 0.6.1, connection, zlib,         conduit, resourcet, http-types, data-default, bytestring, text, mtl,         time >= 1.5.0, HsOpenSSL >= 0.11.2, network-uri >= 2.6, network >= 2.6