-- 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.3


-- | 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 <a>ClassicAppSpec</a>. <a>softwareName</a> is
--   "Classic". <tt>dater</tt> calls <tt>epochTime</tt> for every request.
--   <a>statusFileDir</a> is "/usr/local/share/html/status/".
defaultClassicAppSpec :: ClassicAppSpec
data StatusInfo

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

-- | HTTP status body is created from <a>FilePath</a>.
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 <a>defaultFileAppSpec</a>. <a>indexFile</a> is
--   "index.html". <a>isHTML</a> matches "*.html" and "*.html".
defaultFileAppSpec :: FileAppSpec
data FileRoute
FileRoute :: Path -> Path -> FileRoute

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

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

-- | Handle GET and HEAD for a static file.
--   
--   If <a>pathInfo</a> ends with '/', <a>indexFile</a> is automatically
--   added. In this case, <a>Acceptable-Language:</a> is also handled.
--   Suppose <a>indexFile</a> 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 <a>pathInfo</a> 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 <tt>rawPathInfo</tt>.
[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 <a>defaultCgiAppSpec</a>. <a>indexCgi</a> is
--   "index.cgi".
defaultCgiAppSpec :: CgiAppSpec
data CgiRoute
CgiRoute :: Path -> Path -> CgiRoute

-- | Path prefix to be matched to <tt>rawPathInfo</tt>.
[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:
--   
--   <pre>
--   installHandler sigCHLD Ignore Nothing
--   </pre>
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 <tt>rawPathInfo</tt>.
[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

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

-- | Appending with the file separator.
--   
--   <pre>
--   &gt;&gt;&gt; "/foo" &lt;/&gt; "bar"
--   "/foo/bar"
--   
--   &gt;&gt;&gt; "/foo/" &lt;/&gt; "bar"
--   "/foo/bar"
--   
--   &gt;&gt;&gt; "/foo" &lt;/&gt; "/bar"
--   "/foo/bar"
--   
--   &gt;&gt;&gt; "/foo/" &lt;/&gt; "/bar"
--   "/foo/bar"
--   </pre>
(</>) :: Path -> Path -> Path

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

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

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

-- | Checking if the path ends with the path separator.
--   
--   <pre>
--   &gt;&gt;&gt; hasLeadingPathSeparator "/foo/bar"
--   True
--   
--   &gt;&gt;&gt; hasLeadingPathSeparator "foo/bar"
--   False
--   </pre>
hasLeadingPathSeparator :: Path -> Bool

-- | Checking if the path ends with the path separator.
--   
--   <pre>
--   &gt;&gt;&gt; hasTrailingPathSeparator "/foo/bar/"
--   True
--   
--   &gt;&gt;&gt; hasTrailingPathSeparator "/foo/bar"
--   False
--   </pre>
hasTrailingPathSeparator :: Path -> Bool
isSuffixOf :: Path -> Path -> Bool
redirectHeader :: Request -> ResponseHeaders
hostPort :: Request -> (ByteString, ByteString)
