Skip to content

Commit d0f8b01

Browse files
feature: add timer context support for get_client_body_reader.
1 parent 1833103 commit d0f8b01

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

lib/resty/http.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ function _M.request_uri(self, uri, params)
968968
end
969969

970970

971-
function _M.get_client_body_reader(_, chunksize, sock)
971+
function _M.get_client_body_reader(_, chunksize, sock, headers)
972972
chunksize = chunksize or 65536
973973

974974
if not sock then
@@ -988,8 +988,11 @@ function _M.get_client_body_reader(_, chunksize, sock)
988988
end
989989
end
990990

991-
local headers = ngx_req_get_headers()
992-
local length = headers.content_length
991+
if not headers then
992+
headers = ngx_req_get_headers()
993+
end
994+
995+
local length = headers["Content-Length"]
993996
if length then
994997
return _body_reader(sock, tonumber(length), chunksize)
995998
elseif transfer_encoding_is_chunked(headers) then

0 commit comments

Comments
 (0)