on master help sign in
TLS logging
b8ed790Gert Cuykens
warp-tls/Network/Wai/Handler/WarpTLS.hs+6
@@ -2,6 +2,7 @@
2{-# LANGUAGE RankNTypes #-}
2{-# LANGUAGE RankNTypes #-}
3module Network.Wai.Handler.WarpTLS
3module Network.Wai.Handler.WarpTLS
4 ( TLSSettings (..)
4 ( TLSSettings (..)
5+ , defaultTLS
5 , runTLS
6 , runTLS
6 , runTLSSocket
7 , runTLSSocket
7 ) where
8 ) where
@@ -32,8 +33,12 @@ import Crypto.Random.API (getSystemRandomGen)
32data TLSSettings = TLSSettings
33data TLSSettings = TLSSettings
33 { certFile :: FilePath
34 { certFile :: FilePath
34 , keyFile :: FilePath
35 , keyFile :: FilePath
36+ , debug :: TLS.Logging
35 }
37 }
36
38
39+defaultTLS :: TLSSettings
40+defaultTLS = TLSSettings "cert.pem" "key.pem" TLS.defaultLogging
41+
37runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO ()
42runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO ()
38runTLSSocket tset set sock app = do
43runTLSSocket tset set sock app = do
39 certs <- readCertificates $ certFile tset
44 certs <- readCertificates $ certFile tset
@@ -45,6 +50,7 @@ runTLSSocket tset set sock app = do
45 { TLS.pAllowedVersions = [TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12]
50 { TLS.pAllowedVersions = [TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12]
46 , TLS.pCiphers = ciphers
51 , TLS.pCiphers = ciphers
47 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
52 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
53+ , TLS.pLogging = debug tset
48 }
54 }
49 runSettingsConnectionMaker set (getter params) app
55 runSettingsConnectionMaker set (getter params) app
50 where
56 where