Comments (2)
我个人观点还是不建议通过lor去做上传;另外,针对你说的这个问题,你看下可以提个pr?
from lor.
我们业务中一些非上传业务的body也很大,我是通过middleware给req增加了get_client_body_file函数,然后在body可能超过buffer size的地方主动判断调用,以获取临时文件中的body内容。
pr还的写测试用例😭,以下仅供他人参考吧🙂
----业务代码
if table_is_empty(req.body) then
data = req.get_client_body_file()
if data then
--其他处理逻辑,比如:decode_args或者根据boundary切分
end
end
----注册中间件
local req_plugin = require("middleware.req_plugin")
app:use(req_plugin())
----middleware/req_plugin.lua----代码参考自《openresty最佳实践》中获取请求body一节的代码
local getFile = function(file_name)
local f = assert(io.open(file_name, "r"))
local string = f:read("*all")
f:close()
return string
end
return function()
return function(req, res, next)
req.get_client_body_file = function(self)
local file_name = ngx.req.get_body_file()
if file_name then
return getFile(file_name)
end
end
next()
end
end
from lor.
Related Issues (20)
- 模板引擎能支持一下vue的渲染吗? HOT 2
- session插件问题
- lor error message: may lead to race conditions between concurrent requests HOT 2
- Documentation in English
- 现在还有在维护吗? HOT 2
- demo 无法启动 HOT 1
- 运行lord生成的项目网页直接返回模板文件名 HOT 1
- Windows环境下如何使用呢 HOT 1
- 如何通过systemd 启动lor web站呢? HOT 1
- 使用lor, 没有数据验证和封装好的数据库curd吗?
- trie.lua第75行有bug HOT 4
- post大数据丢失问题 HOT 4
- 有哪些公司生产环境项目在用lor呢? HOT 2
- update lor on opm to 0.3.4 and add lord HOT 1
- 执行命令报错 HOT 6
- node.lua 第26行有警告
- cygwin环境安装sumory/lor成功后报thread.exdata找不到 HOT 2
- 不支持 curl -I HOT 2
- 019/12/28 11:39:36 [error] 18659#18659: *1580 [lua] session.lua:85: func(): cannot get session_data:no cookie found in the current request HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lor.