hails-0.11.0.0: Multi-app web platform framework

Safe HaskellTrustworthy

Hails.HttpServer.Types

Contents

Synopsis

Requests

data Request Source

A request sent by the end-user.

Constructors

Request 

Fields

requestMethod :: Method

HTTP Request (e.g., GET, POST, etc.).

httpVersion :: HttpVersion

HTTP version (e.g., 1.1 or 1.0).

rawPathInfo :: ByteString

Extra path information sent by the client.

rawQueryString :: ByteString

If no query string was specified, this should be empty. This value will include the leading question mark. Do not modify this raw value- modify queryString instead.

serverName :: ByteString

Generally the host requested by the user via the Host request header. Backends are free to provide alternative values as necessary. This value should not be used to construct URLs.

serverPort :: Int

The listening port that the server received this request on. It is possible for a server to listen on a non-numeric port (i.e., Unix named socket), in which case this value will be arbitrary. Like serverName, this value should not be used in URL construction.

requestHeaders :: RequestHeaders

The request headers.

isSecure :: Bool

Was this request made over an SSL connection?

remoteHost :: SockAddr

The client's host information.

pathInfo :: [Text]

Path info in individual pieces- the url without a hostname/port and without a query string, split on forward slashes,

queryString :: Query

Parsed query string information

requestBody :: ByteString

Lazy ByteString containing the request body.

requestTime :: UTCTime

Time request was received.

getRequestBodyType :: Request -> Maybe RequestBodyTypeSource

Get the request body type (copied from wai-extra).

removeRequestHeader :: Request -> HeaderName -> RequestSource

Remove a header (if it exists) from the Request

Responses

data Response Source

A response sent by the app.

Constructors

Response 

Fields

respStatus :: Status

Response status

respHeaders :: ResponseHeaders

Response headers

respBody :: ByteString

Response body

removeResponseHeader :: Response -> HeaderName -> ResponseSource

Remove a header (if it exists) from the Response

Applications and middleware

type Application = RequestConfig -> DCLabeled Request -> DC ResponseSource

Base Hails type implemented by untrusted applications.

data RequestConfig Source

The settings with which the app will run.

Constructors

RequestConfig 

Fields

browserLabel :: DCLabel

The label of the browser the reponse will be sent to.

requestLabel :: DCLabel

The label of the incoming request (with the logged in user's integrity).

appPrivilege :: DCPriv

A privilege minted for the app.

type Middleware = Application -> ApplicationSource

Convenience type for middleware components.