This is an automated email from the ASF dual-hosted git repository.
tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new ee990a0 perf(ext-plugin): use new API to improve setting body (#4806)
ee990a0 is described below
commit ee990a0e28767d49e17178ed5ab8c20719be92e3
Author: 罗泽轩 <[email protected]>
AuthorDate: Fri Aug 13 09:12:47 2021 +0800
perf(ext-plugin): use new API to improve setting body (#4806)
Signed-off-by: spacewander <[email protected]>
---
apisix/plugins/ext-plugin/init.lua | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/apisix/plugins/ext-plugin/init.lua
b/apisix/plugins/ext-plugin/init.lua
index d4392a4..8c76b0e 100644
--- a/apisix/plugins/ext-plugin/init.lua
+++ b/apisix/plugins/ext-plugin/init.lua
@@ -42,7 +42,6 @@ local band = bit.band
local lshift = bit.lshift
local rshift = bit.rshift
local ffi = require("ffi")
-local ffi_new = ffi.new
local ffi_str = ffi.string
local socket_tcp = ngx.socket.tcp
local worker_id = ngx.worker.id
@@ -430,11 +429,7 @@ local rpc_handlers = {
local len = stop:BodyLength()
if len > 0 then
-- TODO: support empty body
- body = ffi_new("unsigned char[?]", len)
- for i = 1, len do
- body[i - 1] = stop:Body(i)
- end
- body = ffi_str(body, len)
+ body = stop:BodyAsString()
end
local code = stop:Status()
-- avoid using 0 as the default http status code