mirror of https://github.com/midoks/mdserver-web
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
529 B
31 lines
529 B
6 years ago
|
|
||
|
|
||
|
function return_message(status,msg)
|
||
|
ngx.header.content_type = "application/json;"
|
||
|
ngx.status = status
|
||
|
ngx.say(json.encode(msg))
|
||
|
ngx.exit(status)
|
||
|
end
|
||
|
|
||
|
|
||
|
function return_html(status,html)
|
||
|
ngx.header.content_type = "text/html"
|
||
|
ngx.status = status
|
||
|
ngx.say(html)
|
||
|
ngx.exit(status)
|
||
|
end
|
||
|
|
||
|
function read_file_body(filename)
|
||
|
fp = io.open(filename,'r')
|
||
|
if fp == nil then
|
||
|
return nil
|
||
|
end
|
||
|
fbody = fp:read("*a")
|
||
|
fp:close()
|
||
|
if fbody == '' then
|
||
|
return nil
|
||
|
end
|
||
|
return fbody
|
||
|
end
|
||
|
|