zero size buf in output 数据只能读一次,是否有更好解决方案?

12 views
Skip to first unread message

xue

unread,
Jun 24, 2022, 4:03:36 AMJun 24
to openresty

client--->openresty--->site

step 1: 上传文件 (client)
curl -F "file_name=@big_file.zip" -X POST "http://www.mysite.com"

step 2: 通过openresty lua进行上传速度限制 (openresty lua)
ngx_req.init_body()
ngx_req.append_body()
ngx_req.read_body()
ngx_req.finish_body()
.....

在openresty中的错误日志:
[alert] 52110#0: *59 zero size buf in output t:1 r:0 f:0 00007F7DD3A3F010 00007F7DD3A3F010-00007F7DD3A3F010 0000000000000000 0-0 while sending request to upstream

step 3: 在站点中将文件保存到磁盘, 但却出错
"Unexpected end of MIME multipart stream. MIME multipart message is not complete"


使用openresty只能读取一次数据流吗?是否有更好的解决方案??

https://github.com/ledgetech/lua-resty-http
通过http自己发请求到站点,但请求时没有写write stream body,只有回应时的read  stream  body。
Reply all
Reply to author
Forward
0 new messages