Http package:happstack-server
guard which checks that an insecure connection was made via http://
Example:
handler :: ServerPart Response
handler =
do http
...
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
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.