Expand description
The request a document is being produced for.
A page rendered on a server is rendered for somebody: a method, an address, a query string, the headers that came with it. This is where that arrives, in the two shapes an app reads it in.
The parts every surface can read are reserved PropertyStore cells, the
same mechanism crate::nav publishes the active page through. Markup
binds to them by name, a derivation reads them, and every script host sees
them without a builtin of its own.
The parts that are too large or too sensitive to publish as signals - the
headers, the cookies and the body - stay in a RequestContext the
renderer installs on its own thread for the length of one render. A script
asks for a named header or a named cookie and gets that one, so a page
never carries the whole Cookie header around in its state.
Nothing here decides which headers an app may see. The renderer that builds the context applies that policy, and what arrives here is what the app is allowed to read.
Structs§
- Request
Context - What is known about the request being rendered for.
- Scope
- The request installed on this thread for as long as this value lives.
Constants§
- HASH_
SIGNAL - Reserved global signal holding the fragment, without the leading
#. - METHOD_
SIGNAL - Reserved global signal holding the request method, uppercased (
GET). - PATH_
SIGNAL - Reserved global signal holding the requested path, without the query
string (
/user/42). - QUERY_
SIGNAL - Reserved global signal holding the query string, without the leading
?(page=2&sort=name). - SECURE_
SIGNAL - Reserved global signal that is true when the request arrived over TLS.
Functions§
- body
- The request body, empty when there was none.
- cookie
- The value of a request cookie, empty when there is none to read.
- current
- The whole request installed on this thread, if there is one.
- enter
- Install
contexton this thread until the returnedScopeis dropped. - hash
- The fragment of the address being rendered for, without the leading
#. - header
- The value of a request header, empty when there is none to read or the app is not allowed to read it.
- install
- Install
contexton this thread for good, and give back whatever was there. - parse_
cookies - Split a
Cookieheader, or a browser’sdocument.cookie, into pairs. - query
- The query string of the address being rendered for, without the leading
?.