This is an automated email from the ASF dual-hosted git repository.
monkeydluffy 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 65deba32f perf(aws-lambda): cache the index of the array (#9944)
65deba32f is described below
commit 65deba32fd113b18181dc32ff38a97f3bed36699
Author: Reid <[email protected]>
AuthorDate: Tue Aug 8 10:28:02 2023 +0800
perf(aws-lambda): cache the index of the array (#9944)
---
apisix/plugins/aws-lambda.lua | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/apisix/plugins/aws-lambda.lua b/apisix/plugins/aws-lambda.lua
index fe4d7f394..1b172af41 100644
--- a/apisix/plugins/aws-lambda.lua
+++ b/apisix/plugins/aws-lambda.lua
@@ -122,8 +122,10 @@ local function request_processor(conf, ctx, params)
-- computing canonical query string
local canonical_qs = {}
+ local canonical_qs_i = 0
for k, v in pairs(params.query) do
- canonical_qs[#canonical_qs+1] = ngx.unescape_uri(k) .. "=" ..
ngx.unescape_uri(v)
+ canonical_qs_i = canonical_qs_i + 1
+ canonical_qs[canonical_qs_i] = ngx.unescape_uri(k) .. "=" ..
ngx.unescape_uri(v)
end
tab_sort(canonical_qs)
@@ -132,10 +134,12 @@ local function request_processor(conf, ctx, params)
-- computing canonical and signed headers
local canonical_headers, signed_headers = {}, {}
+ local signed_headers_i = 0
for k, v in pairs(headers) do
k = k:lower()
if k ~= "connection" then
- signed_headers[#signed_headers+1] = k
+ signed_headers_i = signed_headers_i + 1
+ signed_headers[signed_headers_i] = k
-- strip starting and trailing spaces including strip multiple
spaces into single space
canonical_headers[k] = str_strip(v)
end