Skip to content

Commit 00e6cc5

Browse files
committed
Fix luacheck warnings, whitespace
1 parent 6e4fcff commit 00e6cc5

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

lib/resty/http.lua

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ local ngx_req = ngx.req
66
local ngx_req_socket = ngx_req.socket
77
local ngx_req_get_headers = ngx_req.get_headers
88
local ngx_req_get_method = ngx_req.get_method
9-
local str_gmatch = string.gmatch
109
local str_lower = string.lower
1110
local str_upper = string.upper
1211
local str_find = string.find
@@ -112,14 +111,15 @@ local HTTP = {
112111
[1.1] = " HTTP/1.1\r\n",
113112
}
114113

114+
115115
local DEFAULT_PARAMS = {
116116
method = "GET",
117117
path = "/",
118118
version = 1.1,
119119
}
120120

121121

122-
function _M.new(self)
122+
function _M.new(_)
123123
local sock, err = ngx_socket_tcp()
124124
if not sock then
125125
return nil, err
@@ -230,7 +230,7 @@ local function _should_receive_body(method, code)
230230
end
231231

232232

233-
function _M.parse_uri(self, uri, query_in_path)
233+
function _M.parse_uri(_, uri, query_in_path)
234234
if query_in_path == nil then query_in_path = true end
235235

236236
local m, err = ngx_re_match(uri, [[^(?:(http[s]?):)?//([^:/\?]+)(?::(\d+))?([^\?]*)\??(.*)]], "jo")
@@ -339,6 +339,8 @@ local function _receive_headers(sock)
339339
end
340340

341341
local m, err = ngx_re_match(line, "([^:\\s]+):\\s*(.*)", "jo")
342+
if err then ngx_log(ngx_ERR, err) end
343+
342344
if not m then
343345
break
344346
end
@@ -563,7 +565,7 @@ end
563565

564566

565567
local function _handle_continue(sock, body)
566-
local status, version, reason, err = _receive_status(sock)
568+
local status, version, reason, err = _receive_status(sock) --luacheck: no unused
567569
if not status then
568570
return nil, nil, err
569571
end
@@ -662,7 +664,7 @@ function _M.read_response(self, params)
662664
if not _status then
663665
return nil, _err
664666
elseif _status ~= 100 then
665-
status, version, err = _status, _version, _err
667+
status, version, err = _status, _version, _err -- luacheck: no unused
666668
end
667669
end
668670

@@ -789,6 +791,7 @@ function _M.request_pipeline(self, requests)
789791
return responses
790792
end
791793

794+
792795
function _M.request_uri(self, uri, params)
793796
params = tbl_copy(params or {}) -- Take by value
794797

@@ -891,7 +894,7 @@ function _M.request_uri(self, uri, params)
891894
end
892895

893896

894-
function _M.get_client_body_reader(self, chunksize, sock)
897+
function _M.get_client_body_reader(_, chunksize, sock)
895898
chunksize = chunksize or 65536
896899

897900
if not sock then
@@ -935,7 +938,7 @@ function _M.proxy_request(self, chunksize)
935938
end
936939

937940

938-
function _M.proxy_response(self, response, chunksize)
941+
function _M.proxy_response(_, response, chunksize)
939942
if not response then
940943
ngx_log(ngx_ERR, "no response provided")
941944
return
@@ -968,10 +971,12 @@ function _M.proxy_response(self, response, chunksize)
968971
until not chunk
969972
end
970973

974+
971975
function _M.set_proxy_options(self, opts)
972976
self.proxy_opts = tbl_copy(opts) -- Take by value
973977
end
974978

979+
975980
function _M.get_proxy_uri(self, scheme, host)
976981
if not self.proxy_opts then
977982
return nil
@@ -1070,4 +1075,5 @@ function _M.connect_proxy(self, proxy_uri, scheme, host, port)
10701075
return c, nil
10711076
end
10721077

1078+
10731079
return _M

0 commit comments

Comments
 (0)