1
0
mirror of https://github.com/lammertb/libhttp.git synced 2026-01-03 16:02:30 +03:00

Use .lua in the .lp test

This commit is contained in:
bel
2013-11-18 21:51:55 +01:00
parent ec0aa95d55
commit 66daec3ed7
2 changed files with 4 additions and 6 deletions

View File

@@ -1,8 +1,6 @@
<?
function print(txt) mg.write(txt .. "\r\n") end
mg.write("HTTP/1.1 200 OK\r\n")
n = string.match(mg.request_info.uri, "^(.*)%.lp$")
n = string.gsub(n, [[/]], [[\]])
n = mg.document_root .. n .. ".cgi"
n = mg.document_root .. n .. ".lua"
dofile(n)
?>

View File

@@ -2,8 +2,8 @@ resp = "{";
method = mg.request_info.request_method
uri = mg.request_info.uri
query = os.getenv("QUERY_STRING");
datalen = os.getenv("CONTENT_LENGTH");
query = mg.request_info.query_string
datalen = nil -- TODO: "CONTENT_LENGTH" !
if method then
resp = resp .. '"method" : "' .. method .. '", ';
@@ -24,7 +24,7 @@ resp = resp .. "}";
mg.write("HTTP/1.0 200 OK\n")
mg.write("HTTP/1.1 200 OK\n")
mg.write("Connection: close\n")
mg.write("Content-Type: text/html\n")
mg.write("Cache-Control: no-cache\n")