HTTP-response headers

$response:field[value]
$response:field

The field corresponds with HTTP-response header generated by Parser. It can be both assigned and referred to. The value may be a date, a string or a hash with obligatory key
value.

Note: before assigning or referring value, field name is converted to uppercase letters.   [3.4.4]
Note: during output to the browser all HTTP-response headers' names are capitalized (for example:
content-type are transformed to Content-Type).   [3.4.0]
Note:
assign empty value to remove header.   [3.4.4]
Note: if
$response:status value is set to less than 100, this value will be returned as the exit code of the parser process.   [3.4.5]

Example of redirecting a visitor to site's mainpage
#works if web-site administrator correctly configured SERVER_NAME environment variable
#
usually he/she did
$response:location[http://$env:SERVER_NAME/]

Another example of redirecting a visitor to site's mainpage
#works regardless of SERVER_NAME 
$response:refresh[
   $.value[0]
   $.url[/]
]


Example of assigning header "expires" a value "tomorrow"
$response:expires[^date::now(+1)]


Copyright © 1997–2017 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 26.04.2017