-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Hack2 contrib -- -- Common middlewares and utilities that helps working with Hack2 @package hack2-contrib @version 2011.6.21 module Hack2.Contrib.Middleware.XForwardedForToRemoteHost x_forwarded_for_to_remote_host :: Middleware module Hack2.Contrib.Middleware.Cascade cascade :: [Application] -> Application module Hack2.Contrib.Middleware.IOConfig ioconfig :: (Env -> IO Env) -> Middleware -- | print the env and response in the console module Hack2.Contrib.Middleware.Inspect inspect :: Middleware module Hack2.Contrib.AirBackports u2b :: String -> String b2u :: String -> String file_size :: String -> IO Integer file_mtime :: String -> IO UTCTime now :: IO UTCTime format_time :: String -> UTCTime -> String purify :: IO a -> a simple_time_format :: String parse_time :: String -> String -> UTCTime split_raw :: String -> String -> [String] split :: String -> String -> [String] split' :: String -> [String] sub :: String -> String -> String -> String gsub :: String -> String -> String -> String type RegexResult = (String, (String, String)) type MatchList = [(Int, String)] match :: String -> String -> Maybe (RegexResult, MatchList) strip :: String -> String empty :: String -> Bool module Hack2.Contrib.Mime lookup_mime_type :: ByteString -> Maybe ByteString mime_types :: Map ByteString ByteString -- | print the env and response in the console module Hack2.Contrib.Middleware.Debug debug :: (Env -> Response -> IO ()) -> Middleware -- | Stolen from rack-contrib: modifies the environment using the block -- given during initialization. module Hack2.Contrib.Middleware.Config config :: (Env -> Env) -> Middleware module Hack2.Contrib.Middleware.Censor censor :: (Response -> IO Response) -> Middleware module Hack2.Contrib.Constants status_with_no_entity_body :: [Int] _CacheControl :: ByteString _Connection :: ByteString _Date :: ByteString _Pragma :: ByteString _TransferEncoding :: ByteString _Upgrade :: ByteString _Via :: ByteString _Accept :: ByteString _AcceptCharset :: ByteString _AcceptEncoding :: ByteString _AcceptLanguage :: ByteString _Authorization :: ByteString _Cookie :: ByteString _Expect :: ByteString _From :: ByteString _Host :: ByteString _IfModifiedSince :: ByteString _IfMatch :: ByteString _IfNoneMatch :: ByteString _IfRange :: ByteString _IfUnmodifiedSince :: ByteString _MaxForwards :: ByteString _ProxyAuthorization :: ByteString _Range :: ByteString _Referer :: ByteString _UserAgent :: ByteString _Age :: ByteString _Location :: ByteString _ProxyAuthenticate :: ByteString _Public :: ByteString _RetryAfter :: ByteString _Server :: ByteString _SetCookie :: ByteString _TE :: ByteString _Trailer :: ByteString _Vary :: ByteString _Warning :: ByteString _WWWAuthenticate :: ByteString _Allow :: ByteString _ContentBase :: ByteString _ContentEncoding :: ByteString _ContentLanguage :: ByteString _ContentLength :: ByteString _ContentLocation :: ByteString _ContentMD5 :: ByteString _ContentRange :: ByteString _ContentType :: ByteString _ETag :: ByteString _Expires :: ByteString _LastModified :: ByteString _ContentTransferEncoding :: ByteString _TextPlain :: ByteString _TextHtml :: ByteString _TextPlainUTF8 :: ByteString _TextHtmlUTF8 :: ByteString status_code :: Map Int ByteString module Hack2.Contrib.Utils fromEnumerator :: Monad m => Enumerator ByteString m ByteString -> m ByteString toEnumerator :: Monad m => ByteString -> Enumerator ByteString m a withEnumerator :: Monad m => (ByteString -> ByteString) -> Enumerator ByteString m ByteString -> m (Enumerator ByteString m a) l2s :: ByteString -> ByteString s2l :: ByteString -> ByteString empty_app :: Application -- | usage: app.use [content_type, cache] use :: [Middleware] -> Middleware put :: Eq a => a -> b -> [(a, b)] -> [(a, b)] get :: Eq a => a -> [(a, b)] -> Maybe b bytesize :: ByteString -> Int show_bytestring :: Show a => a -> ByteString map_both :: (a -> b) -> [(a, a)] -> [(b, b)] as_string :: (String -> String) -> ByteString -> ByteString dummy_middleware :: Middleware dummy_app :: Application escape_html :: String -> String escape_uri :: String -> String unescape_uri :: String -> String show_status_message :: Int -> Maybe ByteString httpdate :: UTCTime -> String request_method :: Env -> RequestMethod script_name :: Env -> ByteString path_info :: Env -> ByteString query_string :: Env -> ByteString server_name :: Env -> ByteString server_port :: Env -> Int hack_version :: Env -> (Int, Int, Int) hack_url_scheme :: Env -> HackUrlScheme hack_input :: Env -> HackEnumerator hack_errors :: Env -> HackErrors hack_headers :: Env -> [(ByteString, ByteString)] -- | matching a list of regexp agains a path_info, if matched, consponding -- app is used, otherwise, pass the env down to lower middleware module Hack2.Contrib.Middleware.RegexpRouter regexp_router :: [RoutePath] -> Middleware -- | Stolen from rack: Rack::URLMap takes a hash mapping urls or paths to -- apps, and dispatches accordingly. -- -- URLMap modifies the SCRIPT_NAME and PATH_INFO such that the part -- relevant for dispatch is in the SCRIPT_NAME, and the rest in the -- PATH_INFO. This should be taken care of when you need to reconstruct -- the URL in order to create links. -- -- URLMap dispatches in such a way that the longest paths are tried -- first, since they are most specific. module Hack2.Contrib.Middleware.URLMap url_map :: [RoutePath] -> Middleware module Hack2.Contrib.Response body_bytestring :: Response -> IO ByteString redirect :: ByteString -> Maybe Int -> Response -> Response finish :: Response -> Response header :: ByteString -> Response -> Maybe ByteString has_header :: ByteString -> Response -> Bool set_header :: ByteString -> ByteString -> Response -> Response delete_header :: ByteString -> Response -> Response set_content_type :: ByteString -> Response -> Response set_content_length :: Integral a => a -> Response -> Response set_body :: HackEnumerator -> Response -> Response set_body_bytestring :: ByteString -> Response -> Response set_status :: Int -> Response -> Response set_last_modified :: ByteString -> Response -> Response module Hack2.Contrib.Middleware.NotFound not_found :: Middleware -- | Stolen from rack-contrib: Bounce those annoying favicon.ico requests module Hack2.Contrib.Middleware.BounceFavicon bounce_favicon :: Middleware -- | Stolen from rack: Sets the Content-Length header on responses with -- fixed-length bodies. module Hack2.Contrib.Middleware.ContentLength content_length :: Middleware module Hack2.Contrib.Middleware.Head head :: Middleware module Hack2.Contrib.Middleware.UserMime user_mime :: [(ByteString, ByteString)] -> Middleware -- | Stolen from rack: Sets the Content-Type header on responses which -- don't have one. module Hack2.Contrib.Middleware.ContentType content_type :: ByteString -> Middleware -- | Stolen from rack: serves files below the +root+ given, according to -- the path info of the Rack request. module Hack2.Contrib.Middleware.File file :: Maybe ByteString -> Middleware -- | Stolen from rack: The Rack::Static middleware intercepts requests for -- static files (javascript files, images, stylesheets, etc) based on the -- url prefixes passed in the options, and serves them using a Rack::File -- object. This allows a Rack stack to serve both static and dynamic -- content. module Hack2.Contrib.Middleware.Static static :: Maybe ByteString -> [ByteString] -> Middleware module Hack2.Contrib.Request input_bytestring :: Env -> IO ByteString scheme :: Env -> ByteString port :: Env -> Int path :: Env -> ByteString content_type :: Env -> ByteString media_type :: Env -> ByteString media_type_params :: Env -> [(ByteString, ByteString)] content_charset :: Env -> ByteString host :: Env -> ByteString params :: Env -> [(ByteString, ByteString)] inputs :: Env -> IO [(ByteString, ByteString)] referer :: Env -> ByteString cookies :: Env -> [(ByteString, ByteString)] fullpath :: Env -> ByteString set_http_header :: ByteString -> ByteString -> Env -> Env set_hack_header :: ByteString -> ByteString -> Env -> Env url :: Env -> ByteString remote_host :: Env -> ByteString module Hack2.Contrib.Middleware.SimpleAccessLogger simple_access_logger :: Maybe (ByteString -> IO ()) -> Middleware