refactor: Address issues raised by linter
This commit is contained in:
parent
480c052572
commit
601ad8d59f
21 changed files with 187 additions and 198 deletions
11
src/http.lua
11
src/http.lua
|
@ -41,9 +41,6 @@ local SCHEMES = {
|
|||
https.tcp, 'LuaSocket: Function tcp() not available from LuaSec')
|
||||
return tcp(t) end }}
|
||||
|
||||
-- default scheme and port for document retrieval
|
||||
local SCHEME = 'http'
|
||||
local PORT = SCHEMES[SCHEME].port
|
||||
-----------------------------------------------------------------------------
|
||||
-- Reads MIME headers from a connection, unfolding where needed
|
||||
-----------------------------------------------------------------------------
|
||||
|
@ -92,7 +89,7 @@ socket.sourcet["http-chunked"] = function(sock, headers)
|
|||
-- was it the last chunk?
|
||||
if size > 0 then
|
||||
-- if not, get chunk and skip terminating CRLF
|
||||
local chunk, err, part = sock:receive(size)
|
||||
local chunk, err, _ = sock:receive(size)
|
||||
if chunk then sock:receive() end
|
||||
return chunk, err
|
||||
else
|
||||
|
@ -166,8 +163,8 @@ function metat.__index:receivestatusline()
|
|||
if status ~= "HTTP/" then
|
||||
if ec == "timeout" then
|
||||
return 408
|
||||
end
|
||||
return nil, status
|
||||
end
|
||||
return nil, status
|
||||
end
|
||||
-- otherwise proceed reading a status line
|
||||
status = self.try(self.c:receive("*l", status))
|
||||
|
@ -366,7 +363,7 @@ end
|
|||
local headers
|
||||
-- ignore any 100-continue messages
|
||||
while code == 100 do
|
||||
headers = h:receiveheaders()
|
||||
h:receiveheaders()
|
||||
code, status = h:receivestatusline()
|
||||
end
|
||||
headers = h:receiveheaders()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue