http-client-tls 0.2.4.1 → 0.3.0
raw patch · 4 files changed
+17/−27 lines, 4 filesdep ~http-clientPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: http-client
API changes (from Hackage documentation)
- Network.HTTP.Client.TLS: getTlsConnection :: Maybe TLSSettings -> Maybe SockSettings -> IO (Maybe HostAddress -> String -> Int -> IO Connection)
Files
- ChangeLog.md +4/−0
- Network/HTTP/Client/TLS.hs +10/−21
- http-client-tls.cabal +2/−2
- test/Spec.hs +1/−4
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.3.0++* Support http-client 0.5+ ## 0.2.4.1 * Cabal description fix
Network/HTTP/Client/TLS.hs view
@@ -10,13 +10,11 @@ -- * Global manager , getGlobalManager , setGlobalManager- -- * Internal- , getTlsConnection ) where import Data.Default.Class-import Network.HTTP.Client-import Network.HTTP.Client.Internal+import Network.HTTP.Client hiding (host, port)+import Network.HTTP.Client.Internal hiding (host, port) import Control.Exception import qualified Network.Connection as NC import Network.Socket (HostAddress)@@ -41,27 +39,18 @@ case () of () | ((fromException e)::(Maybe TLS.TLSError))==Just TLS.Error_EOF -> True- | otherwise -> case fromException e of- Just (_ :: IOException) -> True- _ ->- case fromException e of- -- Note: Some servers will timeout connections by accepting- -- the incoming packets for the new request, but closing- -- the connection as soon as we try to read. To make sure- -- we open a new connection under these circumstances, we- -- check for the NoResponseDataReceived exception.- Just NoResponseDataReceived -> True- Just IncompleteHeaders -> True- _ -> False- , managerWrapIOException = + | otherwise -> managerRetryableException defaultManagerSettings e+ , managerWrapException = \req -> let wrapper se = case fromException se of- Just e -> toException $ InternalIOException e+ Just (_ :: IOException) -> se' Nothing -> case fromException se of- Just TLS.Terminated{} -> toException $ TlsException se- Just TLS.HandshakeFailed{} -> toException $ TlsException se- Just TLS.ConnectionNotEstablished -> toException $ TlsException se+ Just TLS.Terminated{} -> se'+ Just TLS.HandshakeFailed{} -> se'+ Just TLS.ConnectionNotEstablished -> se' _ -> se+ where+ se' = toException $ HttpExceptionRequest req $ InternalException se in handle $ throwIO . wrapper }
http-client-tls.cabal view
@@ -1,5 +1,5 @@ name: http-client-tls-version: 0.2.4.1+version: 0.3.0 synopsis: http-client backend using the connection package and tls library description: Hackage documentation generation is not reliable. For up to date documentation, please see: <https://www.stackage.org/package/http-client-tls>. homepage: https://github.com/snoyberg/http-client@@ -18,7 +18,7 @@ other-extensions: ScopedTypeVariables build-depends: base >= 4 && < 5 , data-default-class- , http-client >= 0.3.5+ , http-client >= 0.5.0 , connection >= 0.2.2 , network , tls >= 1.2
test/Spec.hs view
@@ -2,14 +2,11 @@ import Test.Hspec import Network.HTTP.Client import Network.HTTP.Client.TLS-import Network.HTTP.Client.Internal import Network.HTTP.Types main :: IO () main = hspec $ do it "make a TLS connection" $ do manager <- newManager tlsManagerSettings- withResponse "https://httpbin.org/status/418"- { checkStatus = \_ _ _ -> Nothing- } manager $ \res -> do+ withResponse "https://httpbin.org/status/418" manager $ \res -> responseStatus res `shouldBe` status418