Http package:happstack-server

guard which checks that an insecure connection was made via http:// Example:
handler :: ServerPart Response
handler =
do http
...
HTTP version
guard which checks that a secure connection was made via https:// Example:
handler :: ServerPart Response
handler =
do https
...
start the server, and handle requests using the supplied ServerPart. This function will not return, though it may throw an exception. NOTE: The server will only listen on IPv4 due to portability issues in the Network module. For IPv6 support, use simpleHTTPWithSocket with custom socket.
A combination of simpleHTTP'' and mapServerPartT. See mapServerPartT for a discussion of the first argument of this function. NOTE: This function always binds to IPv4 ports until Network module is fixed to support IPv6 in a portable way. Use simpleHTTPWithSocket with custom socket if you want different behaviour.
Generate a result from a ServerPartT and a Request. This is mainly used by CGI (and fast-cgi) wrappers.
Run simpleHTTP with a previously bound socket. Useful if you want to run happstack as user on port 80. Use something like this:
import System.Posix.User (setUserID, UserEntry(..), getUserEntryForName)

main = do
let conf = nullConf { port = 80 }
socket <- bindPort conf
-- do other stuff as root here
getUserEntryForName "www" >>= setUserID . userID
-- finally start handling incoming requests
tid <- forkIO $ simpleHTTPWithSocket socket Nothing conf impl
Note: It's important to use the same conf (or at least the same port) for bindPort and simpleHTTPWithSocket. see also: bindPort, bindIPv4
Like simpleHTTP' with a socket.
Escape from the HTTP world and get direct access to the underlying TimeoutIO functions
Should the connection be used for further messages after this. isHTTP1_0 && hasKeepAlive || isHTTP1_1 && hasNotConnectionClose In addition to this rule All 1xx (informational), 204 (no content), and 304 (not modified) responses MUST NOT include a message-body and therefore are eligible for connection keep-alive.
True if Request is HTTP version 1.0
True if Request is HTTP version 1.1
simpleHTTP is a self-contained HTTP server which can be used to run a ServerPart. A very simple, "Hello World!" web app looks like:
import Happstack.Server
main = simpleHTTP nullConf $ ok "Hello World!"
By default the server will listen on port 8000. Run the app and point your browser at: http://localhost:8000/ For FastCGI support see: http://hackage.haskell.org/package/happstack-fastcgi