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() 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>
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