packages feed

http-client-openssl 0.2.2.0 → 0.3.0.0

raw patch · 3 files changed

+31/−4 lines, 3 filesdep +bytestringdep ~HsOpenSSLdep ~basenew-uploaderPVP ok

version bump matches the API change (PVP)

Dependencies added: bytestring

Dependency ranges changed: HsOpenSSL, base

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,3 +1,8 @@+## 0.3.0.0++* Wrap HsOpenSSL specific exceptions into http-clients own `HttpExceptionRequest`. This is a breaking change and might need adjustment with respect to exception handling in user code.+* More robust handling of unexpectedly closed connections+ ## 0.2.2.0  * Tell OpenSSL what host is being contacted, so it can use the SNI extension for certificate selection if the server requires it.
Network/HTTP/Client/OpenSSL.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE ScopedTypeVariables #-} -- | Support for making connections via the OpenSSL library. module Network.HTTP.Client.OpenSSL     ( opensslManagerSettings@@ -10,6 +11,7 @@ import Control.Exception import Network.Socket.ByteString (sendAll, recv) import OpenSSL+import qualified Data.ByteString as S import qualified Network.Socket as N import qualified OpenSSL.Session       as SSL @@ -41,7 +43,7 @@                     SSL.setTlsextHostName ssl host'                     SSL.connect ssl                     makeConnection-                        (SSL.read ssl 32752)+                        (SSL.read ssl 32752 `catch` \(_ :: SSL.ConnectionAbruptlyTerminated) -> pure S.empty)                         (SSL.write ssl)                         (N.close sock)     , managerTlsProxyConnection = do@@ -73,7 +75,26 @@                     SSL.setTlsextHostName ssl host'                     SSL.connect ssl                     makeConnection-                        (SSL.read ssl 32752)+                        (SSL.read ssl 32752 `catch` \(_ :: SSL.ConnectionAbruptlyTerminated) -> pure S.empty)                         (SSL.write ssl)                         (N.close sock)++    , managerRetryableException = \se ->+        case () of+          ()+            | Just (_ :: SSL.ConnectionAbruptlyTerminated) <- fromException se -> True+            | otherwise -> managerRetryableException defaultManagerSettings se++    , managerWrapException = \req ->+        let+          wrap se+            | Just (_ :: IOException)                      <- fromException se = se'+            | Just (_ :: SSL.SomeSSLException)             <- fromException se = se'+            | Just (_ :: SSL.ConnectionAbruptlyTerminated) <- fromException se = se'+            | Just (_ :: SSL.ProtocolError)                <- fromException se = se'+            | otherwise                                                        = se+            where+              se' = toException (HttpExceptionRequest req (InternalException se))+        in+          handle (throwIO . wrap)     }
http-client-openssl.cabal view
@@ -1,12 +1,12 @@ name:                http-client-openssl-version:             0.2.2.0+version:             0.3.0.0 synopsis:            http-client backend using the OpenSSL library. description:         Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/http-client>. homepage:            https://github.com/snoyberg/http-client license:             MIT license-file:        LICENSE author:              Michael Snoyman-maintainer:          michael@snoyman.com+maintainer:          michael@snoyman.com alexbiehl@gmail.com category:            Network build-type:          Simple cabal-version:       >=1.10@@ -20,6 +20,7 @@   exposed-modules:     Network.HTTP.Client.OpenSSL   other-extensions:    ScopedTypeVariables   build-depends:       base >= 4 && < 5+                     , bytestring                      , http-client >= 0.2                      , network                      , HsOpenSSL