From: Daniel Gruno Date: Thu, 2 Aug 2012 08:13:54 +0000 (+0000) Subject: - Add some information about the fields in the request_rec structure X-Git-Tag: 2.5.0-alpha~6531 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f985f4cd71c8e37a88ad63a8a1dc550e7af45dfd;p=apache - Add some information about the fields in the request_rec structure - Add r.is_https to the list of fields - Add r:escape_html to the list of function calls git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1368377 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index ef6270942f..4893519286 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -228,8 +228,8 @@ end substitution, including the core translate_name hook which maps based on the DocumentRoot. - Note: It is currently undefined as to whether this runs before or after - mod_alias. + Note: Use the early/late flags in the directive to make it run before + or after mod_alias. --]] require 'apache2' @@ -251,165 +251,214 @@ end

The request_rec is mapped in as a userdata. It has a metatable which lets you do useful things with it. For the most part it - has the same fields as the request_rec struct (see httpd.h - until we get better docs here) many of which are writeable as + has the same fields as the request_rec struct, many of which are writeable as well as readable. (The table fields' content can be changed, but the fields themselves cannot be set to different tables.)

- +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name Lua type WritableDescription
ap_auth_type string noIf an authentication check was made, this is set to the type + of authentication (f.x. basic)
args string yesThe query string arguments extracted from the request + (f.x. foo=bar&name=johnsmith)
assbackwards boolean noSet to true if this is an HTTP/0.9 style request + (e.g. GET /foo (with no headers) )
canonical_filename string noThe canonical filename of the request
content_encoding string noThe content encoding of the current request
content_type string yesThe content type of the current request, as determined in the + type_check phase (f.x. image/gif or text/html)
context_prefix string no
context_document_root string no
document_root string noThe document root of the host
err_headers_out table noMIME header environment for the response, printed even on errors and + persist across internal redirects
filename string yesThe file name that the request maps to, f.x. /www/example.com/foo.txt. This can be + changed in the translate-name or map-to-storage phases of a request to allow the + default handler (or script handlers) to serve a different file than what was requested.
handler string yesThe name of the handler that should serve this request, f.x. + lua-script if it is to be served by mod_lua. This is typically set by the + AddHandler or SetHandler + directives, but could also be set via mod_lua to allow another handler to serve up a specific request + that would otherwise not be served by it. +
headers_in table yesMIME header environment from the request. This contains headers such as Host, + User-Agent, Referer and so on.
headers_out table yesMIME header environment for the response.
hostname string noThe host name, as set by the Host: header or by a full URI.
is_httpsbooleannoWhether or not this request is done via HTTPS
log_id string noThe ID to identify request in access and error log.
method string noThe request method, f.x. GET or POST.
notes table yesA list of notes that can be passed on from one module to another.
path_info string noThe PATH_INFO extracted from this request.
protocol string noThe protocol used, f.x. HTTP/1.1
proxyreq string yesDenotes whether this is a proxy request or not. This value is generally set in + the post_read_request/translate_name phase of a request.
range string noThe contents of the Range: header.
subprocess_env table yesThe environment variables set for this request.
status number yesThe (current) HTTP return code for this request, f.x. 200 or 404.
the_request string noThe request string as sent by the client, f.x. GET /foo/bar HTTP/1.1.
unparsed_uri string noThe unparsed URI of the request
uri string yesThe URI after it has been parsed by httpd
user string yesIf an authentication check has been made, this is set to the name of the authenticated user.
useragent_ip string noThe IP of the user agent making the request
@@ -434,6 +483,10 @@ end r:write("a single string") -- print to response body + + + r:escape_html("<html>test</html>") -- Escapes HTML code and returns the escaped result +