import Network.HTTP.Lucu.Resource.Tree
import Network.HTTP.Lucu.ResponseWriter
import Network.HTTP.Lucu.SocketLike as SL
-import System.Posix.Signals
-- |This is the entry point of Lucu httpd. It listens to a socket and
-- waits for clients. 'runHttpd' never stops by itself so the only way
-- to stop it is to raise an exception in the thread running it.
--
--- Note that 'runHttpd' automatically makes SIGPIPE be ignored by
--- calling @'installHandler' 'sigPIPE' 'Ignore' 'Nothing'@. This can
--- hardly cause a problem though.
---
-- Example:
--
-- > {-# LANGUAGE OverloadedStrings #-}
runHttpd ∷ Config → ResTree → [FallbackHandler] → IO ()
runHttpd cnf tree fbs
= withSocketsDo $
- do void $ installHandler sigPIPE Ignore Nothing
- let launchers
+ do let launchers
= catMaybes
[ do scnf ← cnfSSLConfig cnf
addr ← cnfServerV4Addr cnf