packages feed

http-enumerator 0.7.2 → 0.7.2.1

raw patch · 4 files changed

+32/−10 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Network/HTTP/Enumerator.hs view
@@ -114,7 +114,10 @@     ) import qualified Data.Enumerator.List as EL import Network.HTTP.Enumerator.HttpParser-import Control.Exception (Exception, bracket, throwIO, SomeException, try)+import Control.Exception+    ( Exception, bracket, throwIO, SomeException, try+    , fromException+    ) import Control.Arrow (first) import Control.Monad.IO.Class (MonadIO (liftIO)) import Control.Monad.Trans.Class (lift)@@ -209,6 +212,13 @@     withManagedConn man (host', port', False) $         fmap TLS.socketConn $ getSocket host' port' +checkReset :: SomeException -> Bool+checkReset e = isReset || isIOReset+    where isReset = case fromException e of+                      Just TLS.ConnectionReset -> True+                      _ -> False+          isIOReset = show e == "recv: resource vanished (Connection reset by peer)"+ withManagedConn     :: MonadIO m     => Manager@@ -233,9 +243,11 @@                 else TLS.connClose ci             return a)         (\se -> liftIO (TLS.connClose ci) >>-                if isManaged-                    then withManagedConn man key open req step-                    else throwError se)+                liftIO (putStrLn $ "Error during enum: " ++ show se) >>+                if checkReset se && isManaged+                   then withManagedConn man key open req step+                   else throwError se+        )  withSslConn :: MonadIO m             => ([X509] -> IO TLS.TLSCertificateUsage)@@ -348,7 +360,7 @@ -- | Add a Basic Auth header (with the specified user name and password) to the -- given Request. Ignore error handling: -----    applyBasicAuth "user" "pass" $ fromJust $ parseUrl url+--    applyBasicAuth \"user\" \"pass\" $ fromJust $ parseUrl url  applyBasicAuth :: S.ByteString -> S.ByteString -> Request m -> Request m applyBasicAuth user passwd req =@@ -597,7 +609,6 @@ encodeUrlChar c@'_' = [c] encodeUrlChar c@'.' = [c] encodeUrlChar c@'~' = [c]-encodeUrlChar ' ' = "+" encodeUrlChar y =     let (a, c) = fromEnum y `divMod` 16         b = a `mod` 16
Network/HTTP/Enumerator/HttpParser.hs view
@@ -14,6 +14,7 @@ import qualified Data.ByteString.Char8 as S8 import Control.Applicative import Data.Word (Word8)+import Control.Monad (when)  type Header = (S.ByteString, S.ByteString) @@ -66,7 +67,9 @@  parseStatus :: Parser Status parseStatus = do-    _ <- string "HTTP/"+    end <- atEnd+    when end $ fail "EOF reached"+    _ <- manyTill (take 1 >> return ()) (try $ string "HTTP/") <?> "HTTP/"     ver <- takeWhile1 $ not . isSpace     _ <- word8 32 -- space     statCode <- takeWhile1 $ not . isSpace
Network/TLS/Client/Enumerator.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE DeriveDataTypeable #-} module Network.TLS.Client.Enumerator     ( ConnInfo     , connClose@@ -8,11 +9,14 @@     , socketConn     , TLSCertificateRejectReason(..)     , TLSCertificateUsage(..)+    , ConnectionReset (..)     ) where  import Data.ByteString (ByteString) import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L+import Data.Typeable (Typeable)+import Control.Exception (Exception) import System.IO (Handle, hClose) import Network.Socket (Socket, sClose) import Network.Socket.ByteString (recv, sendAll)@@ -21,7 +25,7 @@ import Control.Monad.Trans.Class (lift) import Data.Enumerator     ( Iteratee (..), Enumerator, Step (..), Stream (..), continue, returnI-    , tryIO+    , tryIO, throwError     ) import Data.Certificate.X509 (X509) import Network.TLS.Extra (ciphersuite_all)@@ -33,6 +37,10 @@     , connClose :: IO ()     } +data ConnectionReset = ConnectionReset+    deriving (Show,Typeable)+instance Exception ConnectionReset+ connIter :: MonadIO m => ConnInfo -> Iteratee ByteString m () connIter ConnInfo { connWrite = write } =     continue go@@ -49,7 +57,7 @@     go (Continue k) = do         bs <- tryIO read'         if all S.null bs-            then continue k+            then throwError ConnectionReset             else do                 step <- lift $ runIteratee $ k $ Chunks bs                 go step
http-enumerator.cabal view
@@ -1,5 +1,5 @@ name:            http-enumerator-version:         0.7.2+version:         0.7.2.1 license:         BSD3 license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>