Pārlūkot izejas kodu

Use .lua in the .lp test

bel 11 gadi atpakaļ
vecāks
revīzija
66daec3ed7
2 mainītis faili ar 4 papildinājumiem un 6 dzēšanām
  1. 1 3
      test/ajax/echo.lp
  2. 3 3
      test/ajax/echo.lua

+ 1 - 3
test/ajax/echo.lp

@@ -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.match(mg.request_info.uri, "^(.*)%.lp$")
 n = string.gsub(n, [[/]], [[\]])
 n = string.gsub(n, [[/]], [[\]])
-n = mg.document_root .. n .. ".cgi"
+n = mg.document_root .. n .. ".lua"
 dofile(n)
 dofile(n)
 ?>
 ?>

+ 3 - 3
test/ajax/echo.lua

@@ -2,8 +2,8 @@ resp = "{";
 
 
 method = mg.request_info.request_method
 method = mg.request_info.request_method
 uri = mg.request_info.uri
 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
 if method then
   resp = resp .. '"method" : "' .. method .. '", ';
   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("Connection: close\n")
 mg.write("Content-Type: text/html\n")
 mg.write("Content-Type: text/html\n")
 mg.write("Cache-Control: no-cache\n")
 mg.write("Cache-Control: no-cache\n")