diff options
author | Thijs Schreijer <thijs@thijsschreijer.nl> | 2022-03-18 12:12:39 +0100 |
---|---|---|
committer | Caleb Maclennan <caleb@alerque.com> | 2022-03-19 17:13:15 +0300 |
commit | 601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1 (patch) | |
tree | e3b9c152b9ff8a431d1431edb0a42d051d256f13 /src/http.lua | |
parent | 480c05257211b3e566f33fdf8cf051233e2dab30 (diff) | |
download | luasocket-601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1.tar.gz luasocket-601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1.tar.bz2 luasocket-601ad8d59f11d7180015d0ecfb9d0a8d67f6f5c1.zip |
refactor: Address issues raised by linter
Diffstat (limited to 'src/http.lua')
-rw-r--r-- | src/http.lua | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/http.lua b/src/http.lua index 6a3416e..e3a1742 100644 --- a/src/http.lua +++ b/src/http.lua | |||
@@ -41,9 +41,6 @@ local SCHEMES = { | |||
41 | https.tcp, 'LuaSocket: Function tcp() not available from LuaSec') | 41 | https.tcp, 'LuaSocket: Function tcp() not available from LuaSec') |
42 | return tcp(t) end }} | 42 | return tcp(t) end }} |
43 | 43 | ||
44 | -- default scheme and port for document retrieval | ||
45 | local SCHEME = 'http' | ||
46 | local PORT = SCHEMES[SCHEME].port | ||
47 | ----------------------------------------------------------------------------- | 44 | ----------------------------------------------------------------------------- |
48 | -- Reads MIME headers from a connection, unfolding where needed | 45 | -- Reads MIME headers from a connection, unfolding where needed |
49 | ----------------------------------------------------------------------------- | 46 | ----------------------------------------------------------------------------- |
@@ -92,7 +89,7 @@ socket.sourcet["http-chunked"] = function(sock, headers) | |||
92 | -- was it the last chunk? | 89 | -- was it the last chunk? |
93 | if size > 0 then | 90 | if size > 0 then |
94 | -- if not, get chunk and skip terminating CRLF | 91 | -- if not, get chunk and skip terminating CRLF |
95 | local chunk, err, part = sock:receive(size) | 92 | local chunk, err, _ = sock:receive(size) |
96 | if chunk then sock:receive() end | 93 | if chunk then sock:receive() end |
97 | return chunk, err | 94 | return chunk, err |
98 | else | 95 | else |
@@ -166,8 +163,8 @@ function metat.__index:receivestatusline() | |||
166 | if status ~= "HTTP/" then | 163 | if status ~= "HTTP/" then |
167 | if ec == "timeout" then | 164 | if ec == "timeout" then |
168 | return 408 | 165 | return 408 |
169 | end | 166 | end |
170 | return nil, status | 167 | return nil, status |
171 | end | 168 | end |
172 | -- otherwise proceed reading a status line | 169 | -- otherwise proceed reading a status line |
173 | status = self.try(self.c:receive("*l", status)) | 170 | status = self.try(self.c:receive("*l", status)) |
@@ -366,7 +363,7 @@ end | |||
366 | local headers | 363 | local headers |
367 | -- ignore any 100-continue messages | 364 | -- ignore any 100-continue messages |
368 | while code == 100 do | 365 | while code == 100 do |
369 | headers = h:receiveheaders() | 366 | h:receiveheaders() |
370 | code, status = h:receivestatusline() | 367 | code, status = h:receivestatusline() |
371 | end | 368 | end |
372 | headers = h:receiveheaders() | 369 | headers = h:receiveheaders() |