packages feed

warp-tls 1.4.0.1 → 1.4.1

raw patch · 2 files changed

+28/−9 lines, 2 files

Files

Network/Wai/Handler/WarpTLS.hs view
@@ -2,15 +2,23 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE DeriveDataTypeable #-}-module Network.Wai.Handler.WarpTLS-    ( TLSSettings++-- | HTTP over SSL/TLS support for Warp via the TLS package.++module Network.Wai.Handler.WarpTLS (+    -- * Settings+      TLSSettings     , certFile     , keyFile     , onInsecure-    , OnInsecure (..)+    , tlsLogging+    , defaultTlsSettings     , tlsSettings+    , OnInsecure (..)+    -- * Runner     , runTLS     , runTLSSocket+    -- * Exception     , WarpTLSException (..)     ) where @@ -34,7 +42,6 @@ import Data.Conduit.Network (sourceSocket, sinkSocket, acceptSafe) import Data.Maybe (fromMaybe) import qualified Data.IORef as I-import Control.Monad (unless) import Crypto.Random.API (getSystemRandomGen) import Control.Exception (Exception, throwIO) import Data.Typeable (Typeable)@@ -58,19 +65,30 @@       -- Since 1.4.0     } +-- | An action when a plain HTTP comes to HTTP over TLS/SSL port. data OnInsecure = DenyInsecure L.ByteString                 | AllowInsecure +-- | A smart constructor for 'TLSSettings'. tlsSettings :: FilePath -- ^ Certificate file-            -> FilePath -- ^ key file+            -> FilePath -- ^ Key file             -> TLSSettings-tlsSettings cert key = TLSSettings+tlsSettings cert key = defaultTlsSettings     { certFile = cert     , keyFile = key+    }++-- | Default 'TLSSettings'. Use this to create 'TLSSettings' with the field record name.+defaultTlsSettings :: TLSSettings+defaultTlsSettings = TLSSettings+    { certFile = "certificate.pem"+    , keyFile = "key.pem"     , onInsecure = DenyInsecure "This server only accepts secure HTTPS connections."     , tlsLogging = TLS.defaultLogging     } +-- | Running 'Application' with 'TLSSettings' and 'Settings' using+--   specified 'Socket'. runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO () runTLSSocket TLSSettings {..} set sock app = do     certs   <- readCertificates certFile@@ -142,6 +160,7 @@     deriving (Show, Typeable) instance Exception WarpTLSException +-- | Running 'Application' with 'TLSSettings' and 'Settings'. runTLS :: TLSSettings -> Settings -> Application -> IO () runTLS tset set app =     bracket
warp-tls.cabal view
@@ -1,6 +1,6 @@ Name:                warp-tls-Version:             1.4.0.1-Synopsis:            SSL support for Warp via the TLS package+Version:             1.4.1+Synopsis:            HTTP over SSL/TLS support for Warp via the TLS package License:             MIT License-file:        LICENSE Author:              Michael Snoyman@@ -10,7 +10,7 @@ Build-Type:          Simple Cabal-Version:       >=1.6 Stability:           Stable-Description:         SSL support for Warp via the TLS package+Description:         HTTP over SSL/TLS support for Warp via the TLS package.  Library   Build-Depends:     base                          >= 4        && < 5