aboutsummaryrefslogtreecommitdiff
path: root/src/tp.lua
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-28 06:16:43 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-05-28 06:16:43 +0000
commit694edcc3c1ac3041ff8cdd753a2f7894e8783e6c (patch)
treef8797b4c7671fbf9042fc011277d69d4c3549045 /src/tp.lua
parentbf738a03368b8de9c574d9631f131c5a520acf7b (diff)
downloadluasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.gz
luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.tar.bz2
luasocket-694edcc3c1ac3041ff8cdd753a2f7894e8783e6c.zip
Committing with require.
Diffstat (limited to 'src/tp.lua')
-rw-r--r--src/tp.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tp.lua b/src/tp.lua
index 4f2a615..b671e58 100644
--- a/src/tp.lua
+++ b/src/tp.lua
@@ -20,20 +20,20 @@ TIMEOUT = 60
20 20
21-- gets server reply (works for SMTP and FTP) 21-- gets server reply (works for SMTP and FTP)
22local function get_reply(control) 22local function get_reply(control)
23 local code, current, separator, _ 23 local code, current, sep
24 local line, err = control:receive() 24 local line, err = control:receive()
25 local reply = line 25 local reply = line
26 if err then return nil, err end 26 if err then return nil, err end
27 _, _, code, separator = string.find(line, "^(%d%d%d)(.?)") 27 code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
28 if not code then return nil, "invalid server reply" end 28 if not code then return nil, "invalid server reply" end
29 if separator == "-" then -- reply is multiline 29 if sep == "-" then -- reply is multiline
30 repeat 30 repeat
31 line, err = control:receive() 31 line, err = control:receive()
32 if err then return nil, err end 32 if err then return nil, err end
33 _,_, current, separator = string.find(line, "^(%d%d%d)(.?)") 33 current, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
34 reply = reply .. "\n" .. line 34 reply = reply .. "\n" .. line
35 -- reply ends with same code 35 -- reply ends with same code
36 until code == current and separator == " " 36 until code == current and sep == " "
37 end 37 end
38 return code, reply 38 return code, reply
39end 39end