warp-tls 1.3.2 → 1.3.3
raw patch · 2 files changed
+28/−4 lines, 2 filesdep ~certificatedep ~tlsdep ~tls-extraPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: certificate, tls, tls-extra
API changes (from Hackage documentation)
Files
- Network/Wai/Handler/WarpTLS.hs +24/−0
- warp-tls.cabal +4/−4
Network/Wai/Handler/WarpTLS.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-}+{-# LANGUAGE CPP #-} module Network.Wai.Handler.WarpTLS ( TLSSettings (..) , runTLS@@ -38,12 +39,23 @@ runTLSSocket tset set sock app = do certs <- readCertificates $ certFile tset pk <- readPrivateKey $ keyFile tset+#if MIN_VERSION_tls(1, 0, 0)+ let params =+ TLS.updateServerParams+ (\sp -> sp { TLS.serverWantClientCert = False }) $+ TLS.defaultParamsServer+ { TLS.pAllowedVersions = [TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12]+ , TLS.pCiphers = ciphers+ , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing+ }+#else let params = TLS.defaultParams { TLS.pWantClientCert = False , TLS.pAllowedVersions = [TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12] , TLS.pCiphers = ciphers , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing }+#endif runSettingsConnection set (getter params sock) app where retry :: Socket -> TLS.TLSParams -> Socket -> SomeException -> IO (Connection, SockAddr)@@ -63,6 +75,17 @@ if maybe False ((== 0x16) . fst) (firstBS >>= B.uncons) then do gen <- newGenIO+#if MIN_VERSION_tls(1, 0, 0)+ ctx <- TLS.contextNew+ TLS.Backend+ { TLS.backendFlush = return ()+ , TLS.backendClose = return ()+ , TLS.backendSend = \bs -> C.yield bs C.$$ toClient+ , TLS.backendRecv = getNext . takeMost+ }+ params+ (gen :: SystemRandom)+#else ctx <- TLS.serverWith params (gen :: SystemRandom)@@ -70,6 +93,7 @@ (return ()) -- flush (\bs -> C.yield bs C.$$ toClient) (getNext . takeMost)+#endif TLS.handshake ctx let conn = Connection { connSendMany = TLS.sendData ctx . L.fromChunks
warp-tls.cabal view
@@ -1,5 +1,5 @@ Name: warp-tls-Version: 1.3.2+Version: 1.3.3 Synopsis: SSL support for Warp via the TLS package License: MIT License-file: LICENSE@@ -20,11 +20,11 @@ , transformers >= 0.2 && < 0.4 , conduit >= 0.5 && < 0.6 , network-conduit >= 0.5 && < 0.7- , certificate >= 1.2 && < 1.3+ , certificate >= 1.2 && < 1.4 , pem >= 0.1 && < 0.2 , cryptocipher >= 0.3 && < 0.4- , tls-extra >= 0.4.5 && < 0.5- , tls >= 0.9.6 && < 0.10+ , tls-extra >= 0.4.5 && < 0.6+ , tls >= 0.9.6 && < 1.1 , crypto-api >= 0.8 && < 0.11 , network >= 2.2.1 Exposed-modules: Network.Wai.Handler.WarpTLS