Safe HaskellNone

Ketchup.Utils

Synopsis

Documentation

trim ∷ ByteString → ByteString

Trim whitespace from headers

breakBS ∷ ByteString → ByteString → (ByteString, ByteString)

ByteString breakSubstring wrapper that drops delimiters

fallback ∷ Maybe a → a → a

parseBody ∷ ByteString → [(ByteString, ByteString)]

Parse a URL-encoded Request

sendReply

Arguments

∷ Socket

Socket to write to

→ Int

Status Code to send

→ [(ByteString, [ByteString])]

HTTP headers (Header,[value1, value2])

→ ByteString

Body

→ IO () 

Send a HTTP reply Sends a reply with the given parameters

sendBadRequest ∷ Socket → IO ()

Send 400 Bad Request error

sendNotFound ∷ Socket → IO ()

Send 404 Not Found error

statusMsg

Arguments

∷ Int

Status code (ex. 404)

→ ByteString

Status message (ex. 404 Not Found)

Status Messages Returns status message from a given status id