packages feed

http-client-openssl 0.3.2.0 → 0.3.3

raw patch · 3 files changed

+19/−25 lines, 3 filesdep ~http-clientPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: http-client

API changes (from Hackage documentation)

- Network.HTTP.Client.OpenSSL: withOpenSSL :: () => IO a -> IO a
+ Network.HTTP.Client.OpenSSL: withOpenSSL :: IO a -> IO a

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.3.3++* Use `hostAddress` from `Request`.+ ## 0.3.2.0  * http-client-openssl: added reasonable OpenSSL default settings
Network/HTTP/Client/OpenSSL.hs view
@@ -21,6 +21,7 @@ import qualified Network.Socket as N import qualified OpenSSL.Session as SSL import qualified OpenSSL.X509.SystemStore as SSL (contextLoadSystemCerts)+import Foreign.Storable (sizeOf)  -- | Create a new 'Manager' using 'opensslManagerSettings' and 'defaultMakeContext' -- with 'defaultOpenSSLSettings'.@@ -36,15 +37,15 @@ opensslManagerSettings mkContext = defaultManagerSettings     { managerTlsConnection = do         ctx <- mkContext-        return $ \_ha host' port' ->-            withSocket host' port' $ \sock ->+        return $ \ha' host' port' ->+            withSocket (const $ return ()) ha' host' port' $ \sock ->                 makeSSLConnection ctx sock host'     , managerTlsProxyConnection = do         ctx <- mkContext         return $ \connstr checkConn serverName _ha host' port' ->-            withSocket host' port' $ \sock -> do+            withSocket (const $ return ()) Nothing host' port' $ \sock -> do                 conn <- makeConnection-                        (recv sock 32752)+                        (recv sock bufSize)                         (sendAll sock)                         (return ())                 connectionWrite conn connstr@@ -71,33 +72,22 @@           handle (throwIO . wrap)     }   where-    withSocket host port use = do-        -- Copied/modified from openssl-streams-        let hints      = N.defaultHints-                            { N.addrFlags      = [N.AI_ADDRCONFIG, N.AI_NUMERICSERV]-                            , N.addrFamily     = N.AF_INET-                            , N.addrSocketType = N.Stream-                            }--        (addrInfo:_) <- N.getAddrInfo (Just hints) (Just host) (Just $ show port)--        let family     = N.addrFamily addrInfo-        let socketType = N.addrSocketType addrInfo-        let protocol   = N.addrProtocol addrInfo-        let address    = N.addrAddress addrInfo--        bracketOnError (N.socket family socketType protocol) (N.close) $-            \sock -> N.connect sock address *> use sock-     makeSSLConnection ctx sock host = do         ssl <- SSL.connection ctx sock         SSL.setTlsextHostName ssl host         SSL.enableHostnameValidation ssl host         SSL.connect ssl         makeConnection-           (SSL.read ssl 32752 `catch` \(_ :: SSL.ConnectionAbruptlyTerminated) -> return S.empty)+           (SSL.read ssl bufSize `catch` \(_ :: SSL.ConnectionAbruptlyTerminated) -> return S.empty)+           -- Handling SSL.ConnectionAbruptlyTerminated as a stream end+           -- (some sites terminate SSL connection right after returning the data).            (SSL.write ssl)            (N.close sock)++-- same as Data.ByteString.Lazy.Internal.defaultChunkSize+bufSize :: Int+bufSize = 32 * 1024 - overhead+    where overhead = 2 * sizeOf (undefined :: Int)  defaultMakeContext :: OpenSSLSettings -> IO SSL.SSLContext defaultMakeContext OpenSSLSettings{..} = do
http-client-openssl.cabal view
@@ -1,5 +1,5 @@ name:                http-client-openssl-version:             0.3.2.0+version:             0.3.3 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@@ -21,7 +21,7 @@   other-extensions:    ScopedTypeVariables   build-depends:       base >= 4.10 && < 5                      , bytestring-                     , http-client >= 0.2+                     , http-client >= 0.7.3                      , network                      , HsOpenSSL >= 0.11.4.20                      , HsOpenSSL-x509-system