-- 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.
@package wai-app-file-cgi
@version 0.8.3


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

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

-- | A function for logging. The third argument is a body size.
logger :: ClassicAppSpec -> ApacheLogger

-- | A function to get the HTTP body of status.
dater :: ClassicAppSpec -> IO ZonedDate
statusFileDir :: ClassicAppSpec -> Path

-- | Default value for <a>ClassicAppSpec</a>. <a>softwareName</a> is
--   "Classic". <a>logger</a> does not log at all. <a>dater</a> calls
--   <a>epochTime</a> 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) -> (Path -> IO FileInfo) -> FileAppSpec

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

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

-- | A function to obtain information about a file. If information is not
--   obtained, an IO exception should be raised.
getFileInfo :: FileAppSpec -> Path -> IO FileInfo

-- | Default value for <a>defaultFileAppSpec</a>. <a>indexFile</a> is
--   "index.html". <a>isHTML</a> matches "*.html" and "*.html".
--   <a>getFileInfo</a> calls <a>getFileStatus</a> for every request.
defaultFileAppSpec :: FileAppSpec
data FileInfo
FileInfo :: !Path -> !Integer -> !HTTPDate -> !ByteString -> FileInfo
fileInfoName :: FileInfo -> !Path
fileInfoSize :: FileInfo -> !Integer
fileInfoTime :: FileInfo -> !HTTPDate
fileInfoDate :: FileInfo -> !ByteString
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 <a>index.html</a> and if the value is
--   <a>ja,en</a>, 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

-- | Smart file path.
data Path
Path :: FilePath -> ByteString -> Path
pathString :: Path -> FilePath
pathByteString :: Path -> ByteString
fromString :: IsString a => String -> a
fromByteString :: ByteString -> Path

-- | Appending.
(+++) :: Path -> Path -> Path

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