WAI (Web Application Interface) Application for static files and CGI.
- data ClassicAppSpec = ClassicAppSpec {}
- data StatusInfo
- data FileAppSpec = FileAppSpec {}
- data FileInfo = FileInfo {}
- data FileRoute = FileRoute {}
- fileApp :: ClassicAppSpec -> FileAppSpec -> FileRoute -> Application
- data CgiRoute = CgiRoute {}
- cgiApp :: ClassicAppSpec -> CgiRoute -> Application
- data RevProxyAppSpec = RevProxyAppSpec {}
- data RevProxyRoute = RevProxyRoute {}
- revProxyApp :: ClassicAppSpec -> RevProxyAppSpec -> RevProxyRoute -> Application
- data Path = Path {}
- fromString :: IsString a => String -> a
- fromByteString :: ByteString -> Path
- (+++) :: Path -> Path -> Path
- (</>) :: Path -> Path -> Path
- (<\>) :: Path -> Path -> Path
- (<.>) :: Path -> Path -> Path
- breakAtSeparator :: Path -> (Path, Path)
- hasTrailingPathSeparator :: Path -> Bool
- isSuffixOf :: Path -> Path -> Bool
Common
data ClassicAppSpec Source
ClassicAppSpec | |
|
data StatusInfo Source
StatusByteString ByteString | HTTP status body is created from |
StatusFile Path Integer | HTTP status body is created from |
StatusNone | No HTTP status body. |
Files
data FileAppSpec Source
fileApp :: ClassicAppSpec -> FileAppSpec -> FileRoute -> ApplicationSource
Handle GET and HEAD for a static file.
If pathInfo
ends with '/', indexFile
is automatically
added. In this case, Acceptable-Language: is also handled. Suppose
indexFile
is index.html and if the value is ja,en, then
"index.html.ja", "index.html.en", and "index.html" are tried to be
opened in order.
If pathInfo
does not end with '/' and a corresponding index file
exist, redirection is specified in HTTP response.
Directory contents are NOT automatically listed. To list directory contents, an index file must be created beforehand.
The following HTTP headers are handled: Acceptable-Language:, If-Modified-Since:, Range:, If-Range:, If-Unmodified-Since:.
CGI
cgiApp :: ClassicAppSpec -> CgiRoute -> ApplicationSource
Handle GET and POST for CGI.
The program to link this library must ignore SIGCHLD as follows:
installHandler sigCHLD Ignore Nothing
Reverse Proxy
data RevProxyAppSpec Source
RevProxyAppSpec | |
|
data RevProxyRoute Source
RevProxyRoute | |
|
revProxyApp :: ClassicAppSpec -> RevProxyAppSpec -> RevProxyRoute -> ApplicationSource
Relaying any requests as reverse proxy.
Path
fromString :: IsString a => String -> a
(<\>) :: Path -> Path -> PathSource
Removing prefix. The prefix of the second argument is removed from the first argument.
breakAtSeparator :: Path -> (Path, Path)Source
Breaking at the first path separator.
hasTrailingPathSeparator :: Path -> BoolSource
Checking if the path ends with the path separator.
isSuffixOf :: Path -> Path -> BoolSource