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:
@@ -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)
|
||||
?>
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user