Using mg.request_info.content

This commit is contained in:
Sergey Lyubka committed 2014-01-13 10:58:14 +00:00
1 parent a3663da90e
commit f0571f9fd6
1 file changed
+15 -19
+15 -19
View File
@@ -23,24 +23,20 @@ Content-Type: text/html
<p>Reading POST data from Lua (click submit):</p> <p>Reading POST data from Lua (click submit):</p>
<form method="POST" ><input type="text" name="t1"/><input type="submit"></form> <form method="POST" ><input type="text" name="t1"/><input type="submit"></form>
<pre> <pre>
POST data: [<? POST data: [<? mg.write(mg.request_info.content) ?>]
local post_data = '' request method: [<? mg.write(mg.request_info.request_method) ?>]
if mg.request_info.request_method == 'POST' then IP/port: [<?mg.write(mg.request_info.remote_ip, ':',
post_data = mg.read() mg.request_info.remote_port) ?>]
end URI: [<? mg.write(mg.request_info.uri) ?>]
mg.write(post_data) HTTP version [<? mg.write(mg.request_info.http_version) ?>]
?>] Content Len: [<? mg.write(mg.request_info.content_len) ?>]
request method: [<? mg.write(mg.request_info.request_method) ?>] HEADERS:
IP/port: [<? mg.write(mg.request_info.remote_ip, ':', <?
mg.request_info.remote_port) ?>] for name, value in pairs(mg.request_info.http_headers) do
URI: [<? mg.write(mg.request_info.uri) ?>] mg.write(name, ':', value, '\n')
HTTP version [<? mg.write(mg.request_info.http_version) ?>] end
HEADERS: ?>
<?
for name, value in pairs(mg.request_info.http_headers) do
mg.write(name, ':', value, '\n')
end
?>
</pre> </pre>
</html> </html>