webserver-0.7.1.0: HTTP server library

Safe HaskellNone

Network.Web.Server.Basic

Description

Creating basic WebServer. Created WebServer can handle GET / HEAD / POST; OK, Not Found, Not Modified, Moved Permanently, etc; partial getting; language negotication; CGI, chunked data for CGI output;

Synopsis

Documentation

serveHTTPSource

Arguments

:: Maybe FilePath

Directory to write logfiles, access.log and error.log. Will be created if it doesn't exist. if Nothing, errors will be written to stderr

-> Int

HTTP port

-> ByteString

Server name

-> (Request -> Path)

site mapping function

-> IO () 

Run an HTTP server, using a default BasicConfig. If you need to perform IO in the site mapping function (e.g. to check for the existence of files), use serveHTTPMapIO,

serveHTTPMapIOSource

Arguments

:: Maybe FilePath

Directory to write logfiles, access.log and error.log. Will be created if it doesn't exist. if Nothing, errors will be written to stderr

-> Int

HTTP port

-> ByteString

Server name

-> (Request -> IO Path)

site mapping function, in IO

-> IO () 

Run an HTTP server, using a default BasicConfig. Can perform IO in the site mapping function.

basicServer :: BasicConfig -> WebServerSource

Creating WebServer with BasicConfig. The created WebServer can handle GET / HEAD / POST; OK, Not Found, Not Modified, Moved Permanently, etc; partial getting; language negotication; CGI, chunked data for CGI output; If http://example.com/path does not exist but http://example.com/path/ exists, the created WebServer redirects it. http://example.com/path/ is mapped to /somewhere/path/ by mapper and index.html and index.html.en automatically added and try to read by obtain. If Accept-Language is xx and yy in order, index.html.xx, index.html.yy, index.html and index.html.en are tried. The created WebServer does not dynamically make index.html for a directory even if index.html does not exist for security reasons.