packages feed

mongrel2-handler-0.1.2: src/Mongrel2/Types.hs

module Mongrel2.Types
       ( ClientID
       , Request(..)
       , UUID
       ) where

import Data.ByteString (ByteString)
import Data.Int (Int64)
import Data.Text (Text)
import Network.HTTP.Types (Ascii, HttpVersion, RequestHeaders, StdMethod, Query)

-- | Client identifier from Mongrel2. This identifies the currently
-- connected client uniquely.
type ClientID = Int64

-- | UUID for communicating with Mongrel2.
type UUID = ByteString

-- | Request information.
data Request = Request {
  -- ^ Request path
  reqPath :: [Text],
  -- | Query part of the request
  reqQuery :: Query,
  -- | Raw request path including query part.
  reqRawPath :: ByteString,
  -- | Request method (GET, POST, etc.)
  reqMethod :: Either Ascii StdMethod,
  -- | HTTP version
  reqVersion :: HttpVersion,
  -- | Request headers
  reqHeaders :: RequestHeaders,
  -- | Request body.
  reqBody :: ByteString,
  -- | UUID of the connected Mongrel2 server.
  reqServerUUID :: UUID,
  -- | ID of the connected client browser.
  reqClientID :: ClientID
  } deriving (Show)