-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | File/CGI/Rev Proxy App of WAI
--   
--   This WAI application library handles static files, executes CGI
--   scripts, and serves as a reverse proxy (including EventSource).
@package wai-app-file-cgi
@version 3.1.12

-- | WAI (Web Application Interface) Application for static files and CGI.
module Network.Wai.Application.Classic
data ClassicAppSpec
ClassicAppSpec :: ByteString -> Path -> ClassicAppSpec

-- | Name specified to Server: in HTTP response.
[softwareName] :: ClassicAppSpec -> ByteString

-- | A function to get HTTP's GMT Date.
[statusFileDir] :: ClassicAppSpec -> Path

-- | Default value for ClassicAppSpec. softwareName is
--   "Classic". dater calls epochTime for every request.
--   statusFileDir is "/usr/local/share/html/status/".
defaultClassicAppSpec :: ClassicAppSpec
data StatusInfo

-- | HTTP status body is created from ByteString.
StatusByteString :: ByteString -> StatusInfo

-- | HTTP status body is created from FilePath.
StatusFile :: Path -> Integer -> StatusInfo

-- | No HTTP status body.
StatusNone :: StatusInfo
data FileAppSpec
FileAppSpec :: Path -> (Path -> Bool) -> FileAppSpec

-- | A file name of an index file.
[indexFile] :: FileAppSpec -> Path

-- | Whether this is an HTML or not.
[isHTML] :: FileAppSpec -> Path -> Bool

-- | Default value for defaultFileAppSpec. indexFile is
--   "index.html". isHTML matches "*.html" and "*.html".
defaultFileAppSpec :: FileAppSpec
data FileRoute
FileRoute :: Path -> Path -> FileRoute

-- | Path prefix to be matched to rawPathInfo.
[fileSrc] :: FileRoute -> Path

-- | Path prefix to an actual file system.
[fileDst] :: FileRoute -> Path

-- | 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:.
fileApp :: ClassicAppSpec -> FileAppSpec -> FileRoute -> Application
data RedirectRoute
RedirectRoute :: Path -> Path -> RedirectRoute

-- | Path prefix to be matched to rawPathInfo.
[redirectSrc] :: RedirectRoute -> Path

-- | Path prefix to an actual file system.
[redirectDst] :: RedirectRoute -> Path
redirectApp :: ClassicAppSpec -> RedirectRoute -> Application
data CgiAppSpec
CgiAppSpec :: Path -> CgiAppSpec

-- | A file name of the default CGI.
[indexCgi] :: CgiAppSpec -> Path

-- | Default value for defaultCgiAppSpec. indexCgi is
--   "index.cgi".
defaultCgiAppSpec :: CgiAppSpec
data CgiRoute
CgiRoute :: Path -> Path -> CgiRoute

-- | Path prefix to be matched to rawPathInfo.
[cgiSrc] :: CgiRoute -> Path

-- | Path prefix to an actual file system.
[cgiDst] :: CgiRoute -> Path

-- | Handle GET and POST for CGI.
--   
--   The program to link this library must ignore SIGCHLD as follows:
--   
--   
--   installHandler sigCHLD Ignore Nothing
--   
cgiApp :: ClassicAppSpec -> CgiAppSpec -> CgiRoute -> Application
data RevProxyAppSpec
RevProxyAppSpec :: Manager -> RevProxyAppSpec

-- | Connection manager
[revProxyManager] :: RevProxyAppSpec -> Manager
data RevProxyRoute
RevProxyRoute :: Path -> Path -> ByteString -> Int -> RevProxyRoute

-- | Path prefix to be matched to rawPathInfo.
[revProxySrc] :: RevProxyRoute -> Path

-- | Destination path prefix.
[revProxyDst] :: RevProxyRoute -> Path

-- | Destination domain name.
[revProxyDomain] :: RevProxyRoute -> ByteString

-- | Destination port number.
[revProxyPort] :: RevProxyRoute -> Int

-- | Relaying any requests as reverse proxy.
revProxyApp :: ClassicAppSpec -> RevProxyAppSpec -> RevProxyRoute -> Application
fromString :: IsString a => String -> a
isSuffixOf :: Path -> Path -> Bool

-- | Appending with the file separator.
--   
--   
--   >>> "/foo" </> "bar"
--   "/foo/bar"
--   
--   >>> "/foo/" </> "bar"
--   "/foo/bar"
--   
--   >>> "/foo" </> "/bar"
--   "/foo/bar"
--   
--   >>> "/foo/" </> "/bar"
--   "/foo/bar"
--   
(</>) :: Path -> Path -> Path

-- | Adding suffix.
(<.>) :: Path -> Path -> Path

-- | Checking if the path ends with the path separator.
--   
--   
--   >>> hasTrailingPathSeparator "/foo/bar/"
--   True
--   
--   >>> hasTrailingPathSeparator "/foo/bar"
--   False
--   
hasTrailingPathSeparator :: Path -> Bool

-- | File path.
type Path = ByteString
pathString :: Path -> String

-- | Removing prefix. The prefix of the second argument is removed from the
--   first argument.
--   
--   
--   >>> "foobar" <\> "foo"
--   "bar"
--   
--   >>> "foo" <\> "foobar"
--   ""
--   
--   >>> "foobar" <\> "baz"
--   "bar"
--   
(<\>) :: Path -> Path -> Path

-- | Breaking at the first path separator.
--   
--   
--   >>> breakAtSeparator "/foo/bar/baz"
--   ("","/foo/bar/baz")
--   
--   >>> breakAtSeparator "foo/bar/baz"
--   ("foo","/bar/baz")
--   
--   >>> breakAtSeparator "foo"
--   ("foo","")
--   
breakAtSeparator :: Path -> (Path, Path)

-- | Checking if the path ends with the path separator.
--   
--   
--   >>> hasLeadingPathSeparator "/foo/bar"
--   True
--   
--   >>> hasLeadingPathSeparator "foo/bar"
--   False
--   
hasLeadingPathSeparator :: Path -> Bool
redirectHeader :: Request -> ResponseHeaders
hostPort :: Request -> (ByteString, ByteString)
