]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Httpd.hs
Don't use the unix package at all.
[Lucu.git] / Network / HTTP / Lucu / Httpd.hs
index 2dca5120d8c6e0e21f40b88a03959d4017c848d4..c8a21b7d256d8c0d7128205c18e747dd0b52246f 100644 (file)
@@ -20,16 +20,11 @@ import Network.HTTP.Lucu.RequestReader
 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 #-}
@@ -45,14 +40,13 @@ import System.Posix.Signals
 -- > helloWorld :: ResourceDef
 -- > helloWorld = emptyResource {
 -- >                resGet
--- >                  = Just $ do setContentType $ mkMIMEType "text" "plain"
+-- >                  = Just $ do setContentType $ parseMIMEType "text/plain"
 -- >                              putChunk "Hello, world!"
 -- >              }
 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
@@ -105,7 +99,7 @@ runHttpd cnf tree fbs
       httpLoop ∷ SocketLike s ⇒ PortNumber → s → IO ()
       httpLoop port so
           = do (h, addr)  ← SL.accept so
-               tQueue     ← newInteractionQueue
+               tQueue     ← mkInteractionQueue
                readerTID  ← forkIO $ requestReader cnf tree fbs h port addr tQueue
                _writerTID ← forkIO $ responseWriter cnf h tQueue readerTID
                httpLoop port so