From: Daniel Gruno Date: Mon, 29 Apr 2013 12:31:42 +0000 (+0000) Subject: Note that parseargs and parsebody actually returns two tables, not one. X-Git-Tag: 2.4.5~355 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6e1888e1b75e20cab36de868ea6d169fa927924;p=apache Note that parseargs and parsebody actually returns two tables, not one. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1477001 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index 01489df2f3..74192ba5f7 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -411,13 +411,22 @@ end - r:parseargs() -- returns a lua table containing the request's query string arguments - - -r:parsebody([sizeLimit]) -- parse the request body as a POST and return a lua table. +r:parseargs() -- returns two tables; one standard key/value table for regular GET data, + -- and one for multi-value data (fx. foo=1&foo=2&foo=3): + +local GET, GETMULTI = r:parseargs() +r:puts("Your name is: " .. GET['name'] or "Unknown") + + + +r:parsebody([sizeLimit]) -- parse the request body as a POST and return two lua tables, + -- just like r:parseargs(). -- An optional number may be passed to specify the maximum number - -- of bytes to parse. Default is 8192 bytes. - + -- of bytes to parse. Default is 8192 bytes: + +local POST, POSTMULTI = r:parsebody(1024*1024) +r:puts("Your name is: " .. POST['name'] or "Unknown") + r:puts("hello", " world", "!") -- print to response body