Skip to content

Commit fd34d02

Browse files
committed
optimize: use the key "content-type" to index the headers table returned by ngx.req.get_headers() so as to avoid the overhead of calling the __index metamethod.
1 parent ae69e50 commit fd34d02

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/resty/upload.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ local state_handlers
3333

3434

3535
local function get_boundary()
36-
local header = get_headers().content_type
36+
local header = get_headers()["content-type"]
3737
if not header then
3838
return nil
3939
end

t/sanity.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ failed to read: line too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
225225
';
226226
}
227227
--- more_headers
228-
Content-Type: multipart/form-data; boundary="simple boundary"
228+
content-TYPE: multipart/form-data; boundary="simple boundary"
229229
--- request eval
230230
qq{POST /t
231231
This is the preamble. It is to be ignored, though it

0 commit comments

Comments
 (0)