packages feed

HaskellNet-SSL 0.2.4 → 0.2.5

raw patch · 3 files changed

+15/−5 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Network.HaskellNet.SSL: sslLogToConsole :: Settings -> Bool
- Network.HaskellNet.SSL: Settings :: PortNumber -> Int -> Settings
+ Network.HaskellNet.SSL: Settings :: PortNumber -> Int -> Bool -> Settings

Files

HaskellNet-SSL.cabal view
@@ -1,6 +1,6 @@ name:                HaskellNet-SSL synopsis:            Helpers to connect to SSL/TLS mail servers with HaskellNet-version:             0.2.4+version:             0.2.5 description:         This package ties together the HaskellNet and connection                      packages to make it easy to open IMAP and SMTP connections                      over SSL.
src/Network/HaskellNet/SSL.hs view
@@ -8,10 +8,12 @@ data Settings = Settings               { sslPort          :: PortNumber               , sslMaxLineLength :: Int+              , sslLogToConsole  :: Bool               }  defaultSettingsWithPort :: PortNumber -> Settings defaultSettingsWithPort p = Settings   { sslPort = p   , sslMaxLineLength = 10000+  , sslLogToConsole = False   }
src/Network/HaskellNet/SSL/Internal.hs view
@@ -3,7 +3,6 @@   , connectPlain   ) where - import Network.Connection import Network.HaskellNet.SSL import Network.HaskellNet.BSStream@@ -11,6 +10,8 @@ import qualified Data.ByteString.Char8 as B import Data.Default +import Control.Monad ((>=>))+ type STARTTLS = IO ()  connectionGetBytes :: Connection -> Int -> IO B.ByteString@@ -21,13 +22,20 @@  connectionToStream :: Connection -> Settings -> BSStream connectionToStream c cfg = BSStream-  { bsGet = connectionGetBytes c-  , bsPut = connectionPut c+  { bsGet = connectionGetBytes c >=> withLog "RECV"+  , bsPut = withLog "SEND" >=> connectionPut c   , bsFlush = return ()   , bsClose = connectionClose c   , bsIsOpen = return True-  , bsGetLine = connectionGetLine maxl c+  , bsGetLine = connectionGetLine maxl c >>= withLog "RECV"   } where maxl = sslMaxLineLength cfg+          withLog = if sslLogToConsole cfg then logToConsole+                                           else flip (const . return)++logToConsole :: String -> B.ByteString -> IO B.ByteString+logToConsole dir s = do+    putStrLn $ "HaskellNet-SSL " ++ dir ++ ": " ++ show s+    return s  connectSSL :: String -> Settings -> IO BSStream connectSSL hostname cfg = do