diff options
| author | Caleb Maclennan <caleb@alerque.com> | 2022-03-19 17:42:53 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-19 17:42:53 +0300 |
| commit | a36818d3f3afd8758ec10991a5cb08ebdaca6329 (patch) | |
| tree | 445c27832ac4fb48a03c146fa7c797dc4880c099 /src/ftp.lua | |
| parent | 6952262e6a1315b14935ddd0ea511c202c0154ba (diff) | |
| parent | 8390d07774a1ba1a597d809a1a2562d88ecce19d (diff) | |
| download | luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.tar.gz luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.tar.bz2 luasocket-a36818d3f3afd8758ec10991a5cb08ebdaca6329.zip | |
Merge pull request #354 from lunarmodules/linter
Diffstat (limited to 'src/ftp.lua')
| -rw-r--r-- | src/ftp.lua | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ftp.lua b/src/ftp.lua index bd528ca..0ebc508 100644 --- a/src/ftp.lua +++ b/src/ftp.lua | |||
| @@ -56,7 +56,7 @@ end | |||
| 56 | 56 | ||
| 57 | function metat.__index:login(user, password) | 57 | function metat.__index:login(user, password) |
| 58 | self.try(self.tp:command("user", user or _M.USER)) | 58 | self.try(self.tp:command("user", user or _M.USER)) |
| 59 | local code, reply = self.try(self.tp:check{"2..", 331}) | 59 | local code, _ = self.try(self.tp:check{"2..", 331}) |
| 60 | if code == 331 then | 60 | if code == 331 then |
| 61 | self.try(self.tp:command("pass", password or _M.PASSWORD)) | 61 | self.try(self.tp:command("pass", password or _M.PASSWORD)) |
| 62 | self.try(self.tp:check("2..")) | 62 | self.try(self.tp:check("2..")) |
| @@ -66,7 +66,7 @@ end | |||
| 66 | 66 | ||
| 67 | function metat.__index:pasv() | 67 | function metat.__index:pasv() |
| 68 | self.try(self.tp:command("pasv")) | 68 | self.try(self.tp:command("pasv")) |
| 69 | local code, reply = self.try(self.tp:check("2..")) | 69 | local _, reply = self.try(self.tp:check("2..")) |
| 70 | local pattern = "(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)" | 70 | local pattern = "(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)%D(%d+)" |
| 71 | local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern)) | 71 | local a, b, c, d, p1, p2 = socket.skip(2, string.find(reply, pattern)) |
| 72 | self.try(a and b and c and d and p1 and p2, reply) | 72 | self.try(a and b and c and d and p1 and p2, reply) |
| @@ -83,9 +83,9 @@ end | |||
| 83 | 83 | ||
| 84 | function metat.__index:epsv() | 84 | function metat.__index:epsv() |
| 85 | self.try(self.tp:command("epsv")) | 85 | self.try(self.tp:command("epsv")) |
| 86 | local code, reply = self.try(self.tp:check("229")) | 86 | local _, reply = self.try(self.tp:check("229")) |
| 87 | local pattern = "%((.)(.-)%1(.-)%1(.-)%1%)" | 87 | local pattern = "%((.)(.-)%1(.-)%1(.-)%1%)" |
| 88 | local d, prt, address, port = string.match(reply, pattern) | 88 | local _, _, _, port = string.match(reply, pattern) |
| 89 | self.try(port, "invalid epsv response") | 89 | self.try(port, "invalid epsv response") |
| 90 | self.pasvt = { | 90 | self.pasvt = { |
| 91 | address = self.tp:getpeername(), | 91 | address = self.tp:getpeername(), |
| @@ -102,7 +102,7 @@ end | |||
| 102 | function metat.__index:port(address, port) | 102 | function metat.__index:port(address, port) |
| 103 | self.pasvt = nil | 103 | self.pasvt = nil |
| 104 | if not address then | 104 | if not address then |
| 105 | address, port = self.try(self.tp:getsockname()) | 105 | address = self.try(self.tp:getsockname()) |
| 106 | self.server = self.try(socket.bind(address, 0)) | 106 | self.server = self.try(socket.bind(address, 0)) |
| 107 | address, port = self.try(self.server:getsockname()) | 107 | address, port = self.try(self.server:getsockname()) |
| 108 | self.try(self.server:settimeout(_M.TIMEOUT)) | 108 | self.try(self.server:settimeout(_M.TIMEOUT)) |
| @@ -118,7 +118,7 @@ end | |||
| 118 | function metat.__index:eprt(family, address, port) | 118 | function metat.__index:eprt(family, address, port) |
| 119 | self.pasvt = nil | 119 | self.pasvt = nil |
| 120 | if not address then | 120 | if not address then |
| 121 | address, port = self.try(self.tp:getsockname()) | 121 | address = self.try(self.tp:getsockname()) |
| 122 | self.server = self.try(socket.bind(address, 0)) | 122 | self.server = self.try(socket.bind(address, 0)) |
| 123 | address, port = self.try(self.server:getsockname()) | 123 | address, port = self.try(self.server:getsockname()) |
| 124 | self.try(self.server:settimeout(_M.TIMEOUT)) | 124 | self.try(self.server:settimeout(_M.TIMEOUT)) |
| @@ -142,7 +142,7 @@ function metat.__index:send(sendt) | |||
| 142 | local command = sendt.command or "stor" | 142 | local command = sendt.command or "stor" |
| 143 | -- send the transfer command and check the reply | 143 | -- send the transfer command and check the reply |
| 144 | self.try(self.tp:command(command, argument)) | 144 | self.try(self.tp:command(command, argument)) |
| 145 | local code, reply = self.try(self.tp:check{"2..", "1.."}) | 145 | local code, _ = self.try(self.tp:check{"2..", "1.."}) |
| 146 | -- if there is not a pasvt table, then there is a server | 146 | -- if there is not a pasvt table, then there is a server |
| 147 | -- and we already sent a PORT command | 147 | -- and we already sent a PORT command |
| 148 | if not self.pasvt then self:portconnect() end | 148 | if not self.pasvt then self:portconnect() end |
