on master help sign in
Added support for setting up which TLS versions the server should allow
commit0d7948dc813b305bb805d0569ae7f4f4762968b5 authorHugoDaniel <mr.hugo.gomes@gmail.com> dateFri 29 Nov 2013, 10:59 (13 years ago) parentca598ed
1 file changed+7−1
warp-tls/Network/Wai/Handler/WarpTLS.hs+7−1
warp-tls/Network/Wai/Handler/WarpTLS.hs+7−1
@@ -67,6 +67,11 @@ data TLSSettings = TLSSettings
6767 -- Default: 'TLS.defaultLogging'.
6868 --
6969 -- Since 1.4.0
70+ , tlsAllowedVersions :: [TLS.Version]
71+ -- ^ The TLS versions this server accepts.
72+ --
73+ -- Default: '[TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12]'.
74+ --
7075 }
7176
7277-- | An action when a plain HTTP comes to HTTP over TLS/SSL port.
@@ -89,6 +94,7 @@ defaultTlsSettings = TLSSettings
8994 , keyFile = "key.pem"
9095 , onInsecure = DenyInsecure "This server only accepts secure HTTPS connections."
9196 , tlsLogging = TLS.defaultLogging
97+ , tlsAllowedVersions = [TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12]
9298 }
9399
94100-- | Running 'Application' with 'TLSSettings' and 'Settings' using
@@ -101,7 +107,7 @@ runTLSSocket TLSSettings {..} set sock app = do
101107 TLS.updateServerParams
102108 (\sp -> sp { TLS.serverWantClientCert = False }) $
103109 TLS.defaultParamsServer
104− { TLS.pAllowedVersions = [TLS.SSL3,TLS.TLS10,TLS.TLS11,TLS.TLS12]
110+ { TLS.pAllowedVersions = tlsAllowedVersions
105111 , TLS.pCiphers = ciphers
106112 , TLS.pCertificates = zip certs $ (Just pk):repeat Nothing
107113 , TLS.pLogging = tlsLogging