wai-2.1.0.1: Web Application Interface.

Safe HaskellNone

Network.Wai.Internal

Description

Internal constructors and helper functions. Note that no guarantees are given for stability of these interfaces.

Synopsis

Documentation

data Request Source

Information on the request sent by the client. This abstracts away the details of the underlying implementation.

Constructors

Request 

Fields

requestMethod :: Method

Request method such as GET.

httpVersion :: HttpVersion

HTTP version such as 1.1.

rawPathInfo :: ByteString

Extra path information sent by the client. The meaning varies slightly depending on backend; in a standalone server setting, this is most likely all information after the domain name. In a CGI application, this would be the information following the path to the CGI executable itself. Do not modify this raw value- modify pathInfo instead.

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.

requestHeaders :: RequestHeaders

A list of header (a pair of key and value) in an HTTP request.

isSecure :: Bool

Was this request made over an SSL connection?

Note that this value will not tell you if the client originally made this request over SSL, but rather whether the current connection is SSL. The distinction lies with reverse proxies. In many cases, the client will connect to a load balancer over SSL, but connect to the WAI handler without SSL. In such a case, isSecure will be False, but from a user perspective, there is a secure 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 :: Source IO ByteString

A request body provided as Source.

vault :: Vault

A location for arbitrary data to be shared by applications and middleware.

requestBodyLength :: RequestBodyLength

The size of the request body. In the case of a chunked request body, this may be unknown.

Since 1.4.0

requestHeaderHost :: Maybe ByteString

The value of the Host header in a HTTP request.

Since 2.0.0

requestHeaderRange :: Maybe ByteString

The value of the Range header in a HTTP request.

Since 2.0.0

Instances

data Response Source

The strange structure of the third field or ResponseSource is to allow for exception-safe resource allocation. As an example:

 app :: Application
 app _ = return $ ResponseSource status200 [] $ \f -> bracket
     (putStrLn "Allocation" >> return 5)
     (\i -> putStrLn $ "Cleaning up: " ++ show i)
     (\_ -> f $ do
         yield $ Chunk $ fromByteString "Hello "
         yield $ Chunk $ fromByteString "World!")

Instances

type WithRawApp b = (RawApp -> IO b) -> IO bSource

type WithSource m a b = (Source m a -> m b) -> m bSource

Auxiliary type for ResponseSource.

data RequestBodyLength Source

The size of the request body. In the case of chunked bodies, the size will not be known.

Since 1.4.0

data FilePart Source

Information on which part to be sent. Sophisticated application handles Range (and If-Range) then create FilePart.

Instances