-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ @package main module Ketchup.Utils -- | Trim whitespace from headers trim :: ByteString -> ByteString -- | ByteString breakSubstring wrapper that drops delimiters breakBS :: ByteString -> ByteString -> (ByteString, ByteString) fallback :: Maybe a -> a -> a -- | Parse a URL-encoded Request parseBody :: ByteString -> [(ByteString, ByteString)] -- | Send a HTTP reply Sends a reply with the given parameters sendReply :: Socket -> Int -> [(ByteString, [ByteString])] -> ByteString -> IO () -- | Send 400 Bad Request error sendBadRequest :: Socket -> IO () -- | Send 404 Not Found error sendNotFound :: Socket -> IO () -- | Status Messages Returns status message from a given status id statusMsg :: Int -> ByteString module Ketchup.Httpd -- | HTTP Request type This holds a complete HTTP request data HTTPRequest HTTPRequest :: ByteString -> ByteString -> ByteString -> Headers -> ByteString -> HTTPRequest -- | Get HTTP Request Method (GET, POST etc.) method :: HTTPRequest -> ByteString -- | Get Request URI uri :: HTTPRequest -> ByteString -- | Get HTTP Version httpver :: HTTPRequest -> ByteString -- | Get HTTP Headers (header, [values]) headers :: HTTPRequest -> Headers -- | Get HTTP Post body (raw string) body :: HTTPRequest -> ByteString type Headers = [(ByteString, [ByteString])] type Handler = Socket -> HTTPRequest -> IO () -- | Listens for incoming HTTP request listenHTTP :: String -> PortNumber -> Handler -> IO () instance Show HTTPRequest module Ketchup.Chunked -- | Send HTTP reply headers and begin a Chunked transmission chunkHeaders :: Socket -> Int -> [(ByteString, [ByteString])] -> IO () -- | Sends a chunk chunk :: Socket -> ByteString -> IO () -- | Send the final/closing chunk endchunk :: Socket -> IO () module Ketchup.Routing type Route = Socket -> HTTPRequest -> (ByteString -> Maybe ByteString) -> IO () -- | Router function Takes a list of routes and iterates through them for -- every requeust route :: [(ByteString, Route)] -> Handler -- | Wrap a handler in a route Lets you use a handler (no parameters) as a -- route useHandler :: Handler -> Route module Ketchup.Static -- | Static file handler Takes a directory and returns a route static :: ByteString -> Handler module Ketchup.Auth -- | Performs HTTP Basic Auth basicAuth :: [(ByteString, ByteString)] -> ByteString -> Handler -> Handler