In some scenarios, we only want to read the first n bytes of the HTTP body. However, the ngx.req.get_body_data() always returns all the data. If the body size is large, the overhead of copying memory between the Lua VM and the Nginx worker will be even greater.
So, can you add an optional "limit" parameter to this interface?
-- return first 1024
ngx.req.get_body_data(1024)
-- return all
ngx.req.get_body_data()
If you think this feature is valuable, I can submit a pull request.
In some scenarios, we only want to read the first n bytes of the HTTP body. However, the ngx.req.get_body_data() always returns all the data. If the body size is large, the overhead of copying memory between the Lua VM and the Nginx worker will be even greater. So, can you add an optional "limit" parameter to this interface?
If you think this feature is valuable, I can submit a pull request.
thx