warp-tls 3.4.13 → 3.4.14
raw patch · 3 files changed
+47/−9 lines, 3 filesdep +stmdep ~warpnew-uploader
Dependencies added: stm
Dependency ranges changed: warp
Files
- ChangeLog.md +5/−0
- Network/Wai/Handler/WarpTLS.hs +37/−6
- warp-tls.cabal +5/−3
ChangeLog.md view
@@ -1,5 +1,10 @@ # ChangeLog +## 3.4.14++* Build with `warp-3.4.13`.+ [#1071](https://github.com/yesodweb/wai/pull/1071)+ ## 3.4.13 * Introduced new smart constructor `tlsSettingsSni` to make it more convenient
Network/Wai/Handler/WarpTLS.hs view
@@ -59,6 +59,9 @@ ) where import Control.Applicative ((<|>))+#if MIN_VERSION_warp(3,4,13)+import Control.Concurrent.STM (newTVarIO, TVar)+#endif import Control.Exception ( Exception, IOException,@@ -72,6 +75,7 @@ throwIO, try, )+import qualified Control.Exception as E import Control.Monad (guard, void) import qualified Data.ByteString as S import qualified Data.ByteString.Lazy as L@@ -89,7 +93,6 @@ #endif withSocketsDo, )-import qualified Control.Exception as E import Network.Socket.BufferPool import Network.Socket.ByteString (sendAll) import qualified Network.TLS as TLS@@ -274,10 +277,16 @@ -> Socket -> Application -> IO ()-runTLSSocket' tlsset@TLSSettings{..} set credentials mgr sock =- runSettingsConnectionMakerSecure set get+runTLSSocket' tlsset@TLSSettings{..} set credentials mgr sock app = do+#if MIN_VERSION_warp(3,4,13)+ (_, newSettings) <- makeServerState set+ let get = getter tlsset newSettings sock params+ runSettingsConnectionMakerSecure newSettings get app+#else+ let get = getter tlsset set sock params+ runSettingsConnectionMakerSecure set get app+#endif where- get = getter tlsset set sock params params = TLS.defaultParamsServer { TLS.serverWantClientCert = tlsWantClientCert@@ -382,7 +391,14 @@ where makeConn = do pool <- newBufferPool 2048 16384- rawRecvN <- makeRecvN bs0 $ receive s pool+#if MIN_VERSION_warp(3,4,13)+ appsInProgress <- newTVarIO 0+ (ss, _) <- makeServerState set+ let recv = makeGracefulRecv s pool ss appsInProgress+#else+ let recv = receive s pool+#endif+ rawRecvN <- makeRecvN bs0 recv let recvN = wrappedRecvN rawRecvN ctx <- TLS.contextNew (backend recvN) params TLS.contextHookSetLogging ctx tlsLogging@@ -390,7 +406,11 @@ mconn <- timeout tm $ do TLS.handshake ctx mysa <- getSocketName s+#if MIN_VERSION_warp(3,4,13)+ attachConn mysa ctx appsInProgress+#else attachConn mysa ctx+#endif case mconn of Nothing -> throwIO IncompleteHeaders Just conn -> return conn@@ -419,8 +439,16 @@ -- | Get "Connection" and "Transport" for a TLS connection that is already did the handshake. -- @since 3.4.7-attachConn :: SockAddr -> TLS.Context -> IO (Connection, Transport)+attachConn+ :: SockAddr+ -> TLS.Context+#if MIN_VERSION_warp(3,4,13)+ -> TVar Int -> IO (Connection, Transport)+attachConn mysa ctx appsInProgress = do+#else+ -> IO (Connection, Transport) attachConn mysa ctx = do+#endif h2 <- (== Just "h2") <$> TLS.getNegotiatedProtocol ctx isH2 <- I.newIORef h2 writeBuffer <- createWriteBuffer 16384@@ -440,6 +468,9 @@ , connWriteBuffer = writeBufferRef , connHTTP2 = isH2 , connMySockAddr = mysa+#if MIN_VERSION_warp(3,4,13)+ , connAppsInProgress = appsInProgress+#endif } where sendall = TLS.sendData ctx . L.fromChunks . return
warp-tls.cabal view
@@ -1,5 +1,5 @@ Name: warp-tls-Version: 3.4.13+Version: 3.4.14 Synopsis: HTTP over TLS support for Warp via the TLS package License: MIT License-file: LICENSE@@ -22,9 +22,10 @@ , bytestring >= 0.9 , wai >= 3.2 && < 3.3 , warp >= 3.3.29 && < 3.5- , tls >= 2.1.3 && < 2.2+ , tls >= 2.1.3 && < 2.5 , network >= 2.2.1 , streaming-commons+ , stm >= 2.3 , tls-session-manager >= 0.0.4 , recv >= 0.1.0 && < 0.2.0 Exposed-modules: Network.Wai.Handler.WarpTLS@@ -39,4 +40,5 @@ source-repository head type: git- location: git://github.com/yesodweb/wai.git+ location: https://github.com/yesodweb/wai.git+ subdir: warp-tls