增加测试例子

This commit is contained in:
wanglei 2025-10-17 15:43:19 +08:00
parent 5191044d8a
commit a8b3fb9cfb
2 changed files with 19 additions and 10 deletions

View File

@ -1,5 +1,5 @@
worker_processes auto; #nginx worker 数量
error_log logs/error.log; #指定错误日志文件路径
error_log /home/frankly/work/AuthPlatform/logs/error.log info; #指定错误日志文件路径
#worker_rlimit_nofile 65535;
@ -8,8 +8,9 @@ events {
}
http {
client_max_body_size 10k; #允许最大100k的请求体
client_body_buffer_size 4k; #设置缓冲区大小
##lua_need_request_body on; #开启读取请求体数据
client_max_body_size 1024M; #允许最大100k的请求体
client_body_buffer_size 1024M; #设置缓冲区大小
lua_package_path '$prefix/src/?/?.lua;$prefix/src/?.lua;/home/frankly/work/AuthPlatform/src/?.lua;/home/frankly/work/AuthPlatform/src/?/?.lua;;';
lua_package_cpath '$prefix/src/share/lib/?.so;;';

View File

@ -10,17 +10,23 @@ ngx.req.read_body()
--获取请求数据
local body_data = ngx.req.get_body_data()
if not body_data then
ngx.say("read file error:"..err)
return ngx.exit(400)
end
--if not body_data then
-- ngx.say("read file error:", err)
-- return ngx.exit(400)
--end
local len = #body_data
ngx.say(body_data)
--local file_name = ngx.req.get_body_file()
ngx.say("file length:", len)
--ngx.req.read_body_in_buffer(ngx.var.request_body_file)
--ngx.say(body_data)
--local cjson = require("cjson")
--local file_path = "/home/frankly/work/test.dat"
--local file_length = 1024 * 1024 * 380
--local file_length = 1024 * 1024 * 400
--local f, err = io.input(file_path, "r")
--if not f then
-- ngx.say("read file error:"..err)
@ -33,5 +39,7 @@ ngx.say(body_data)
-- key = "data",
-- value = content
--}
----ngx.header["Length"] = #content
--ngx.header["Content-Type"] = 'application/json; charset=UTF-8'
--ngx.say(cjson.encode(res))
--ngx.say(cjson.encode(res))
--ngx.log(ngx.INFO, "send data success")