module Happstack.Server.SimpleHTTPS
( TLSConf(..)
, nullTLSConf
, simpleHTTPS
, simpleHTTPS'
) where
import Data.Maybe (fromMaybe)
import Happstack.Server (ToMessage(..), UnWebT, ServerPartT, simpleHTTP'', mapServerPartT, runValidator)
import Happstack.Server.Internal.TLS (TLSConf(..), nullTLSConf, listenTLS)
simpleHTTPS :: (ToMessage a) =>
TLSConf
-> ServerPartT IO a
-> IO ()
simpleHTTPS = simpleHTTPS' id
simpleHTTPS' :: (ToMessage b, Monad m, Functor m) =>
(UnWebT m a -> UnWebT IO b)
-> TLSConf
-> ServerPartT m a
-> IO ()
simpleHTTPS' toIO tlsConf hs =
listenTLS tlsConf (\req -> runValidator (fromMaybe return (tlsValidator tlsConf)) =<< (simpleHTTP'' (mapServerPartT toIO hs) req))