Commit f0571f9f authored by Sergey Lyubka's avatar Sergey Lyubka

Using mg.request_info.content

parent a3663da9
......@@ -23,24 +23,20 @@ Content-Type: text/html
<p>Reading POST data from Lua (click submit):</p>
<form method="POST" ><input type="text" name="t1"/><input type="submit"></form>
<pre>
POST data: [<?
local post_data = ''
if mg.request_info.request_method == 'POST' then
post_data = mg.read()
end
mg.write(post_data)
?>]
request method: [<? mg.write(mg.request_info.request_method) ?>]
IP/port: [<? mg.write(mg.request_info.remote_ip, ':',
mg.request_info.remote_port) ?>]
URI: [<? mg.write(mg.request_info.uri) ?>]
HTTP version [<? mg.write(mg.request_info.http_version) ?>]
HEADERS:
<?
for name, value in pairs(mg.request_info.http_headers) do
mg.write(name, ':', value, '\n')
end
?>
<pre>
POST data: [<? mg.write(mg.request_info.content) ?>]
request method: [<? mg.write(mg.request_info.request_method) ?>]
IP/port: [<?mg.write(mg.request_info.remote_ip, ':',
mg.request_info.remote_port) ?>]
URI: [<? mg.write(mg.request_info.uri) ?>]
HTTP version [<? mg.write(mg.request_info.http_version) ?>]
Content Len: [<? mg.write(mg.request_info.content_len) ?>]
HEADERS:
<?
for name, value in pairs(mg.request_info.http_headers) do
mg.write(name, ':', value, '\n')
end
?>
</pre>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment