packages feed

network-simple-tls 0.3.1 → 0.3.2

raw patch · 3 files changed

+20/−18 lines, 3 filesdep ~network-simple

Dependency ranges changed: network-simple

Files

changelog.md view
@@ -1,3 +1,10 @@+# Version 0.3.2++* Added `sendLazy`.++* Fixed space leak on `recv`. See issue #13.++ # Version 0.3.1  * Added SOCKS5 proxy support. See functions `connectOverSOCKS5` and
network-simple-tls.cabal view
@@ -1,5 +1,5 @@ name:                network-simple-tls-version:             0.3.1+version:             0.3.2 synopsis:            Simple interface to TLS secured network sockets. description:         Simple interface to TLS secured network sockets. homepage:            https://github.com/k0001/network-simple-tls@@ -21,11 +21,11 @@ library   hs-source-dirs:    src   exposed-modules:   Network.Simple.TCP.TLS-  build-depends:     base              (>=4.5     && <5.0)+  build-depends:     base >=4.5 && <5.0                    , bytestring                    , data-default                    , network-                   , network-simple+                   , network-simple >=0.4.3                    , safe-exceptions                    , tls                    , transformers
src/Network/Simple/TCP/TLS.hs view
@@ -42,6 +42,7 @@   -- * Utils   , recv   , send+  , sendLazy    -- * Low level support   , useTls@@ -83,7 +84,6 @@ import           Network.Simple.TCP (HostPreference(Host, HostAny, HostIPv4, HostIPv6)) import           Network.Socket (HostName, ServiceName, Socket, SockAddr) import qualified Network.Socket as NS-import qualified Network.Socket.ByteString as NSB import qualified Network.TLS as T import           Network.TLS (Context) import           Network.TLS.Extra as TE@@ -456,7 +456,7 @@ -- given TCP `Socket` connected to the remote end. makeClientContext :: MonadIO m => ClientSettings -> Socket -> m Context makeClientContext (ClientSettings params) sock = liftIO $ do-    T.contextNew (socketBackend sock) params+    T.contextNew sock params  -------------------------------------------------------------------------------- @@ -488,7 +488,7 @@ -- given TCP `Socket` connected to the remote end. makeServerContext :: MonadIO m => ServerSettings -> Socket -> m Context makeServerContext (ServerSettings params) sock = liftIO $ do-    T.contextNew (socketBackend sock) params+    T.contextNew sock params  -------------------------------------------------------------------------------- @@ -546,9 +546,15 @@ -- | Encrypts the given strict 'B.ByteString' and sends it through the -- 'Context'. send :: MonadIO m => Context -> B.ByteString -> m ()-send ctx = \bs -> T.sendData ctx (BL.fromChunks [bs])+send ctx = \bs -> T.sendData ctx (BL.fromStrict bs) {-# INLINABLE send #-} +-- | Encrypts the given lazy 'BL.ByteString' and sends it through the+-- 'Context'.+sendLazy :: MonadIO m => Context -> BL.ByteString -> m ()+sendLazy = T.sendData+{-# INLINE sendLazy #-}+ -------------------------------------------------------------------------------- -- Internal utils @@ -562,15 +568,4 @@                   } | Errno ioe == ePIPE           -> return ()         _ -> E.throwIO e---- | Makes an TLS context `T.Backend` from a `Socket`.-socketBackend :: Socket -> T.Backend-socketBackend sock = do-    T.Backend (return ()) (S.closeSock sock) (NSB.sendAll sock) recvAll-  where-    recvAll = step B.empty-       where step !acc 0 = return acc-             step !acc n = do-                bs <- NSB.recv sock n-                step (acc `B.append` bs) (n - B.length bs)