1mg.write("HTTP/1.0 200 OK\r\n")
2mg.write("Content-Type: text/plain\r\n")
3mg.write("\r\n")
4mg.write(mg.request_info.request_method .. " " .. mg.request_info.request_uri .. "  HTTP/" .. mg.request_info.http_version .. "\r\n")
5for k,v in pairs(mg.request_info.http_headers) do
6  mg.write(k .. ": " .. v .. "\r\n")
7end
8mg.write("\r\n")
9
10repeat
11  local r = mg.read()
12  if (r) then
13    mg.write(r)
14  end
15until not r
16
17