1 {-|
    2 
    3 This module contains the core type definitions, class instances, and functions
    4 for HTTP as well as the 'Snap' monad, which is used for web handlers.
    5 
    6 -}
    7 module Snap.Types
    8   (
    9     -- * The Snap Monad
   10     Snap
   11   , runSnap
   12   , MonadSnap(..)
   13   , NoHandlerException(..)
   14 
   15     -- ** Functions for control flow and early termination
   16   , bracketSnap
   17   , finishWith
   18   , catchFinishWith
   19   , pass
   20 
   21     -- ** Routing
   22   , method
   23   , methods
   24   , path
   25   , pathArg
   26   , dir
   27   , ifTop
   28   , route
   29   , routeLocal
   30 
   31     -- ** Access to state
   32   , getRequest
   33   , getResponse
   34   , putRequest
   35   , putResponse
   36   , modifyRequest
   37   , modifyResponse
   38   , localRequest
   39   , withRequest
   40   , withResponse
   41 
   42     -- ** Logging
   43   , logError
   44 
   45     -- ** Grabbing/transforming request bodies
   46   , runRequestBody
   47   , getRequestBody
   48   , transformRequestBody
   49 
   50     -- * HTTP Datatypes and Functions
   51     -- $httpDoc
   52     --
   53   , Request
   54   , Response
   55   , Headers
   56   , HasHeaders(..)
   57   , Params
   58   , Method(..)
   59   , Cookie(..)
   60   , HttpVersion
   61 
   62     -- ** Headers
   63   , addHeader
   64   , setHeader
   65   , getHeader
   66   , deleteHeader
   67   , ipHeaderFilter
   68   , ipHeaderFilter'
   69 
   70     -- ** Requests
   71   , rqServerName
   72   , rqServerPort
   73   , rqRemoteAddr
   74   , rqRemotePort
   75   , rqLocalAddr
   76   , rqLocalHostname
   77   , rqIsSecure
   78   , rqContentLength
   79   , rqMethod
   80   , rqVersion
   81   , rqCookies
   82   , rqPathInfo
   83   , rqContextPath
   84   , rqURI
   85   , rqQueryString
   86   , rqParams
   87   , rqParam
   88   , getParam
   89   , getParams
   90   , rqModifyParams
   91   , rqSetParam
   92 
   93     -- ** Responses
   94   , emptyResponse
   95   , setResponseCode
   96   , setResponseStatus
   97   , rspStatus
   98   , rspStatusReason
   99   , setContentType
  100   , addCookie
  101   , addResponseCookie
  102   , getResponseCookie
  103   , getResponseCookies
  104   , deleteResponseCookie
  105   , modifyResponseCookie
  106   , getCookie
  107   , readCookie
  108   , setContentLength
  109   , clearContentLength
  110   , redirect
  111   , redirect'
  112 
  113     -- *** Response I/O
  114   , setResponseBody
  115   , modifyResponseBody
  116   , addToOutput
  117   , writeBuilder
  118   , writeBS
  119   , writeLazyText
  120   , writeText
  121   , writeLBS
  122   , sendFile
  123   , sendFilePartial
  124 
  125     -- ** Timeouts
  126   , setTimeout
  127   , getTimeoutAction
  128 
  129     -- * Iteratee
  130   , Enumerator
  131   , SomeEnumerator(..)
  132 
  133     -- * HTTP utilities
  134   , formatHttpTime
  135   , parseHttpTime
  136   , urlEncode
  137   , urlDecode
  138   ) where
  139 
  140 ------------------------------------------------------------------------------
  141 import           Snap.Internal.Http.Types
  142 import           Snap.Internal.Instances ()
  143 import           Snap.Internal.Routing
  144 import           Snap.Internal.Types
  145 import           Snap.Iteratee (Enumerator)
  146 ------------------------------------------------------------------------------
  147 
  148 -- $httpDoc
  149 -- HTTP-related datatypes: 'Request', 'Response', 'Cookie', etc.