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

-- | Provides some basic WAI handlers and middleware.
--   
--   The goal here is to provide common features without many dependencies.
@package wai-extra
@version 1.3.3.2

module Network.Wai.Middleware.Vhost
vhost :: [(Request -> Bool, Application)] -> Application -> Application
redirectWWW :: Text -> Application -> Application

module Network.Wai.Middleware.Rewrite

-- | rewrite based on your own conversion rules
rewrite :: ([Text] -> RequestHeaders -> IO [Text]) -> Middleware

-- | rewrite based on your own conversion rules Example convert function:
rewritePure :: ([Text] -> RequestHeaders -> [Text]) -> Middleware

-- | Changes the request-method via first post-parameter _method.
module Network.Wai.Middleware.MethodOverridePost

-- | Allows overriding of the HTTP request method via the _method post
--   string parameter.
--   
--   
--   
- Looks for the Content-Type requestHeader.
--   
- If the header is set to application/x-www-form-urlencoded and the
--   first POST parameter is _method then it changes the request-method to
--   the value of that parameter.
--   
- This middlware only applies when the initial request method is
--   POST.
--   
methodOverridePost :: Middleware

module Network.Wai.Middleware.MethodOverride

-- | Allows overriding of the HTTP request method via the _method query
--   string parameter.
--   
--   This middlware only applies when the initial request method is POST.
--   This allow submitting of normal HTML forms, without worries of
--   semantics mismatches in the HTTP spec.
methodOverride :: Middleware

-- | Automatic wrapping of JSON responses to convert into JSONP.
module Network.Wai.Middleware.Jsonp

-- | Wrap json responses in a jsonp callback.
--   
--   Basically, if the user requested a "text/javascript" and supplied a
--   "callback" GET parameter, ask the application for an
--   "application/json" response, then convern that into a JSONP response,
--   having a content type of "text/javascript" and calling the specified
--   callback function.
jsonp :: Middleware

-- | Automatic gzip compression of responses.
module Network.Wai.Middleware.Gzip

-- | Use gzip to compress the body of the response.
--   
--   Analyzes the "Accept-Encoding" header from the client to determine if
--   gzip is supported.
--   
--   Possible future enhancements:
--   
--   
--   
- Only compress if the response is above a certain size.
--   
gzip :: GzipSettings -> Middleware
data GzipSettings
gzipFiles :: GzipSettings -> GzipFiles
data GzipFiles
GzipIgnore :: GzipFiles
GzipCompress :: GzipFiles
GzipCacheFolder :: FilePath -> GzipFiles
gzipCheckMime :: GzipSettings -> ByteString -> Bool

-- | The default value for this type.
def :: Default a => a
defaultCheckMime :: ByteString -> Bool
instance Show GzipFiles
instance Eq GzipFiles
instance Read GzipFiles
instance Default GzipSettings

-- | Some helpers for parsing data out of a raw WAI Request.
module Network.Wai.Parse

-- | Parse the HTTP accept string to determine supported content types.
parseHttpAccept :: ByteString -> [ByteString]
parseRequestBody :: BackEnd y -> Request -> ResourceT IO ([Param], [File y])
data RequestBodyType
UrlEncoded :: RequestBodyType
Multipart :: ByteString -> RequestBodyType
getRequestBodyType :: Request -> Maybe RequestBodyType
sinkRequestBody :: BackEnd y -> RequestBodyType -> Sink ByteString (ResourceT IO) ([Param], [File y])
conduitRequestBody :: BackEnd y -> RequestBodyType -> Conduit ByteString (ResourceT IO) (Either Param (File y))

-- | A file uploading backend. Takes the parameter name, file name, and
--   content type, and returns a Sink for storing the contents.
type BackEnd a = ByteString -> FileInfo () -> Sink ByteString (ResourceT IO) a

-- | Store uploaded files in memory
lbsBackEnd :: Monad m => ignored1 -> ignored2 -> Sink ByteString m ByteString

-- | Save uploaded files on disk as temporary files
tempFileBackEnd :: MonadResource m => ignored1 -> ignored2 -> Sink ByteString m FilePath

-- | Same as tempFileSink, but use configurable temp folders and
--   patterns.
tempFileBackEndOpts :: MonadResource m => IO FilePath -> String -> ignored1 -> ignored2 -> Sink ByteString m FilePath

-- | Post parameter name and value.
type Param = (ByteString, ByteString)

-- | Post parameter name and associated file information.
type File y = (ByteString, FileInfo y)

-- | Information on an uploaded file.
data FileInfo c
FileInfo :: ByteString -> ByteString -> c -> FileInfo c
fileName :: FileInfo c -> ByteString
fileContentType :: FileInfo c -> ByteString
fileContent :: FileInfo c -> c

-- | Parse a content type value, turning a single ByteString into
--   the actual content type and a list of pairs of attributes.
--   
--   Since 1.3.2
parseContentType :: ByteString -> (ByteString, [(ByteString, ByteString)])
instance Eq c => Eq (FileInfo c)
instance Show c => Show (FileInfo c)
instance Eq Bound
instance Show Bound

module Network.Wai.Middleware.RequestLogger

-- | Production request logger middleware. Implemented on top of
--   logCallback, but prints to stdout
logStdout :: Middleware

-- | Development request logger middleware. Implemented on top of
--   logCallbackDev, but prints to stdout
--   
--   Flushes stdout on each request, which would be inefficient in
--   production use. Use logStdout in production.
logStdoutDev :: Middleware
mkRequestLogger :: RequestLoggerSettings -> IO Middleware
data RequestLoggerSettings

-- | Default value: Detailed True.
outputFormat :: RequestLoggerSettings -> OutputFormat

-- | Only applies when using the Handle constructor for
--   destination.
--   
--   Default value: True.
autoFlush :: RequestLoggerSettings -> Bool

-- | Default: Handle stdout.
destination :: RequestLoggerSettings -> Destination
data OutputFormat
Apache :: IPAddrSource -> OutputFormat

-- | use colors?
Detailed :: Bool -> OutputFormat
CustomOutputFormat :: OutputFormatter -> OutputFormat
type OutputFormatter = ZonedDate -> Request -> Status -> Maybe Integer -> [LogStr]
data Destination
Handle :: Handle -> Destination
Logger :: Logger -> Destination
Callback :: Callback -> Destination
type Callback = [LogStr] -> IO ()

-- | Source from which the IP source address of the client is obtained.
data IPAddrSource :: *

-- | From the peer address of the HTTP connection.
FromSocket :: IPAddrSource

-- | From X-Real-IP: or X-Forwarded-For: in the HTTP header.
FromHeader :: IPAddrSource
instance Default RequestLoggerSettings

module Network.Wai.Middleware.CleanPath
cleanPath :: ([Text] -> Either ByteString [Text]) -> ByteString -> ([Text] -> Application) -> Application

-- | Automatically produce responses to HEAD requests based on the
--   underlying applications GET response.
module Network.Wai.Middleware.Autohead
autohead :: Middleware

module Network.Wai.Middleware.AcceptOverride
acceptOverride :: Middleware

-- | Backend for Common Gateway Interface. Almost all users should use the
--   run function.
module Network.Wai.Handler.CGI

-- | Run an application using CGI.
run :: Application -> IO ()

-- | Some web servers provide an optimization for sending files via a
--   sendfile system call via a special header. To use this feature,
--   provide that header name here.
runSendfile :: ByteString -> Application -> IO ()

-- | A generic CGI helper, which allows other backends (FastCGI and SCGI)
--   to use the same code as CGI. Most users will not need this function,
--   and can stick with run or runSendfile.
runGeneric :: [(String, String)] -> (Int -> Source (ResourceT IO) ByteString) -> (ByteString -> IO ()) -> Maybe ByteString -> Application -> IO ()
requestBodyFunc :: (Int -> IO (Maybe ByteString)) -> Int -> Source (ResourceT IO) ByteString
