on master help sign in
more docs.
c2f60baKazu Yamamoto
warp-tls/Network/Wai/Handler/WarpTLS.hs+6
@@ -65,9 +65,11 @@ data TLSSettings = TLSSettings
65 -- Since 1.4.0
65 -- Since 1.4.0
66 }
66 }
67
67
68+-- | An action when a plain HTTP comes to HTTP over TLS/SSL port.
68data OnInsecure = DenyInsecure L.ByteString
69data OnInsecure = DenyInsecure L.ByteString
69 | AllowInsecure
70 | AllowInsecure
70
71
72+-- | A smart constructor for 'TLSSettings'.
71tlsSettings :: FilePath -- ^ Certificate file
73tlsSettings :: FilePath -- ^ Certificate file
72 -> FilePath -- ^ Key file
74 -> FilePath -- ^ Key file
73 -> TLSSettings
75 -> TLSSettings
@@ -76,6 +78,7 @@ tlsSettings cert key = defaultTlsSettings
76 , keyFile = key
78 , keyFile = key
77 }
79 }
78
80
81+-- | Default 'TLSSettings'. Use this to create 'TLSSettings' with the field record name.
79defaultTlsSettings :: TLSSettings
82defaultTlsSettings :: TLSSettings
80defaultTlsSettings = TLSSettings
83defaultTlsSettings = TLSSettings
81 { certFile = "certificate.pem"
84 { certFile = "certificate.pem"
@@ -84,6 +87,8 @@ defaultTlsSettings = TLSSettings
84 , tlsLogging = TLS.defaultLogging
87 , tlsLogging = TLS.defaultLogging
85 }
88 }
86
89
90+-- | Running 'Application' with 'TLSSettings' and 'Settings' using
91+-- specified 'Socket'.
87runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO ()
92runTLSSocket :: TLSSettings -> Settings -> Socket -> Application -> IO ()
88runTLSSocket TLSSettings {..} set sock app = do
93runTLSSocket TLSSettings {..} set sock app = do
89 certs <- readCertificates certFile
94 certs <- readCertificates certFile
@@ -155,6 +160,7 @@ data WarpTLSException = InsecureConnectionDenied
155 deriving (Show, Typeable)
160 deriving (Show, Typeable)
156instance Exception WarpTLSException
161instance Exception WarpTLSException
157
162
163+-- | Running 'Application' with 'TLSSettings' and 'Settings'.
158runTLS :: TLSSettings -> Settings -> Application -> IO ()
164runTLS :: TLSSettings -> Settings -> Application -> IO ()
159runTLS tset set app =
165runTLS tset set app =
160 bracket
166 bracket