-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | extend happstack-server with https:// support (TLS/SSL)
--   
--   extend happstack-server with https:/<i> support (TLS</i>SSL)
@package happstack-server-tls
@version 7.1.6.3


-- | <ul>
--   <li>- borrowed from snap-server. Check there periodically for
--   updates.</li>
--   </ul>
module Happstack.Server.Internal.TimeoutSocketTLS
sPutLazyTickle :: Handle -> SSL -> ByteString -> IO ()
sPutTickle :: Handle -> SSL -> ByteString -> IO ()
sGetContents :: Handle -> SSL -> IO ByteString
timeoutSocketIO :: Handle -> Socket -> SSL -> TimeoutIO
sendFileTickle :: Handle -> SSL -> FilePath -> Offset -> ByteCount -> IO ()


-- | core functions and types for HTTPS support
module Happstack.Server.Internal.TLS

-- | wrapper around <a>logM</a> for this module
log' :: Priority -> String -> IO ()

-- | configuration for using https://
data TLSConf
TLSConf :: Int -> FilePath -> FilePath -> Maybe FilePath -> Int -> Maybe (LogAccess UTCTime) -> Maybe (Response -> IO Response) -> TLSConf
[tlsPort] :: TLSConf -> Int
[tlsCert] :: TLSConf -> FilePath
[tlsKey] :: TLSConf -> FilePath
[tlsCA] :: TLSConf -> Maybe FilePath
[tlsTimeout] :: TLSConf -> Int
[tlsLogAccess] :: TLSConf -> Maybe (LogAccess UTCTime)

-- | a function to validate the output on-the-fly
[tlsValidator] :: TLSConf -> Maybe (Response -> IO Response)

-- | a partially complete <a>TLSConf</a> . You must sete <a>tlsCert</a> and
--   <a>tlsKey</a> at a mininum.
nullTLSConf :: TLSConf

-- | record that holds the <a>Socket</a> and <a>SSLContext</a> needed to
--   start the https:// event loop. Used with
--   <tt>simpleHTTPWithSocket'</tt>
--   
--   see also: <tt>httpOnSocket</tt>
data HTTPS
HTTPS :: Socket -> SSLContext -> HTTPS
[httpsSocket] :: HTTPS -> Socket
[sslContext] :: HTTPS -> SSLContext

-- | generate the <a>HTTPS</a> record needed to start the https:// event
--   loop
httpsOnSocket :: FilePath -> FilePath -> Maybe FilePath -> Socket -> IO HTTPS

-- | accept a TLS connection
acceptTLS :: Socket -> SSLContext -> IO SSL

-- | https:/<i> <a>Request</a></i><a>Response</a> loop
--   
--   This function initializes SSL, and starts accepting and handling
--   <a>Request</a>s and sending <tt>Respone</tt>s.
--   
--   Each <a>Request</a> is processed in a separate thread.
listenTLS :: TLSConf -> (Request -> IO Response) -> IO ()

-- | low-level https:/<i> <a>Request</a></i><a>Response</a> loop
--   
--   This is the low-level loop that reads <a>Request</a>s and sends
--   <tt>Respone</tt>s. It assumes that SSL has already been initialized
--   and that socket is listening.
--   
--   Each <a>Request</a> is processed in a separate thread.
--   
--   see also: <a>listenTLS</a>
listenTLS' :: Int -> Maybe (LogAccess UTCTime) -> HTTPS -> (Request -> IO Response) -> IO ()

module Happstack.Server.SimpleHTTPS

-- | configuration for using https://
data TLSConf
TLSConf :: Int -> FilePath -> FilePath -> Maybe FilePath -> Int -> Maybe (LogAccess UTCTime) -> Maybe (Response -> IO Response) -> TLSConf
[tlsPort] :: TLSConf -> Int
[tlsCert] :: TLSConf -> FilePath
[tlsKey] :: TLSConf -> FilePath
[tlsCA] :: TLSConf -> Maybe FilePath
[tlsTimeout] :: TLSConf -> Int
[tlsLogAccess] :: TLSConf -> Maybe (LogAccess UTCTime)

-- | a function to validate the output on-the-fly
[tlsValidator] :: TLSConf -> Maybe (Response -> IO Response)

-- | a partially complete <a>TLSConf</a> . You must sete <a>tlsCert</a> and
--   <a>tlsKey</a> at a mininum.
nullTLSConf :: TLSConf

-- | start the https:// server, and handle requests using the supplied
--   <tt>ServerPart</tt>.
--   
--   This function will not return, though it may throw an exception.
simpleHTTPS :: (ToMessage a) => TLSConf -> ServerPartT IO a -> IO ()

-- | similar <a>simpleHTTPS</a> but allows you to supply a function to
--   convert <tt>m</tt> to <a>IO</a>.
simpleHTTPS' :: (ToMessage b, Monad m, Functor m) => (UnWebT m a -> UnWebT IO b) -> TLSConf -> ServerPartT m a -> IO ()
