{-# OPTIONS_HADDOCK not-home #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
module Network.Wai.Internal where
import Blaze.ByteString.Builder (Builder)
import qualified Data.ByteString as B
import Data.Text (Text)
import Data.Typeable (Typeable)
import Data.Vault.Lazy (Vault)
import Data.Word (Word64)
import qualified Network.HTTP.Types as H
import Network.Socket (SockAddr)
data Request = Request {
requestMethod :: H.Method
, httpVersion :: H.HttpVersion
, rawPathInfo :: B.ByteString
, rawQueryString :: B.ByteString
, requestHeaders :: H.RequestHeaders
, isSecure :: Bool
, remoteHost :: SockAddr
, pathInfo :: [Text]
, queryString :: H.Query
, requestBody :: IO B.ByteString
, vault :: Vault
, requestBodyLength :: RequestBodyLength
, requestHeaderHost :: Maybe B.ByteString
, requestHeaderRange :: Maybe B.ByteString
}
deriving (Typeable)
data Response
= ResponseFile H.Status H.ResponseHeaders FilePath (Maybe FilePart)
| ResponseBuilder H.Status H.ResponseHeaders Builder
| ResponseStream H.Status H.ResponseHeaders StreamingBody
| ResponseRaw (IO B.ByteString -> (B.ByteString -> IO ()) -> IO ()) Response
deriving Typeable
type StreamingBody = (Builder -> IO ()) -> IO () -> IO ()
data RequestBodyLength = ChunkedBody | KnownLength Word64
data FilePart = FilePart
{ filePartOffset :: Integer
, filePartByteCount :: Integer
, filePartFileSize :: Integer
} deriving Show
data ResponseReceived = ResponseReceived
deriving Typeable