aboutsummaryrefslogtreecommitdiff
path: root/src/tp.lua
diff options
context:
space:
mode:
authorThijs Schreijer <thijs.schreijer@bookingexperts.com>2026-08-10 15:27:12 +0200
committerThijs Schreijer <thijs@thijsschreijer.nl>2026-08-29 17:42:13 +0200
commit52f9f91d91aa33a1483334f69073f3e6250cd168 (patch)
tree5f7b6cea31c496b4ccc94f834cb9a051445780ae /src/tp.lua
parent827ae20771d34912a8f79b50dc68e6430945b9eb (diff)
downloadluasocket-52f9f91d91aa33a1483334f69073f3e6250cd168.tar.gz
luasocket-52f9f91d91aa33a1483334f69073f3e6250cd168.tar.bz2
luasocket-52f9f91d91aa33a1483334f69073f3e6250cd168.zip
refactor(receive): make implicit line reads explicit
Diffstat (limited to 'src/tp.lua')
-rw-r--r--src/tp.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tp.lua b/src/tp.lua
index b8ebc56..bf4bc14 100644
--- a/src/tp.lua
+++ b/src/tp.lua
@@ -26,14 +26,14 @@ _M.TIMEOUT = 60
26-- gets server reply (works for SMTP and FTP) 26-- gets server reply (works for SMTP and FTP)
27local function get_reply(c) 27local function get_reply(c)
28 local code, current, sep 28 local code, current, sep
29 local line, err = c:receive() 29 local line, err = c:receive("*l")
30 local reply = line 30 local reply = line
31 if err then return nil, err end 31 if err then return nil, err end
32 code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 32 code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
33 if not code then return nil, "invalid server reply" end 33 if not code then return nil, "invalid server reply" end
34 if sep == "-" then -- reply is multiline 34 if sep == "-" then -- reply is multiline
35 repeat 35 repeat
36 line, err = c:receive() 36 line, err = c:receive("*l")
37 if err then return nil, err end 37 if err then return nil, err end
38 current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)")) 38 current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
39 reply = reply .. "\n" .. line 39 reply = reply .. "\n" .. line