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 ...@@ -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()
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) ?>] mg.request_info.remote_port) ?>]
URI: [<? mg.write(mg.request_info.uri) ?>] URI: [<? mg.write(mg.request_info.uri) ?>]
HTTP version [<? mg.write(mg.request_info.http_version) ?>] HTTP version [<? mg.write(mg.request_info.http_version) ?>]
HEADERS: Content Len: [<? mg.write(mg.request_info.content_len) ?>]
<? HEADERS:
<?
for name, value in pairs(mg.request_info.http_headers) do for name, value in pairs(mg.request_info.http_headers) do
mg.write(name, ':', value, '\n') mg.write(name, ':', value, '\n')
end end
?> ?>
</pre> </pre>
</html> </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