Allow ftp client to handle 220 multiline messages
This commit is contained in:
parent
32ec7f2f5f
commit
c687e2b9d2
1 changed files with 12 additions and 2 deletions
|
|
@ -263,8 +263,18 @@ proc connect*[T](ftp: FtpBase[T]) =
|
||||||
else:
|
else:
|
||||||
{.fatal: "Incorrect socket instantiation".}
|
{.fatal: "Incorrect socket instantiation".}
|
||||||
|
|
||||||
# TODO: Handle 120? or let user handle it.
|
var reply = ftp.expectReply()
|
||||||
assertReply ftp.expectReply(), "220"
|
if reply.startsWith("120"):
|
||||||
|
# 120 Service ready in nnn minutes.
|
||||||
|
# We wait until we receive 220.
|
||||||
|
reply = ftp.expectReply()
|
||||||
|
|
||||||
|
# Handle 220 messages from the server
|
||||||
|
if reply.startsWith("220"):
|
||||||
|
assertReply(reply, "220")
|
||||||
|
while reply.continuesWith("-", 3): # handle multiline 220 message
|
||||||
|
assertReply(reply, "220")
|
||||||
|
reply = await ftp.expectReply()
|
||||||
|
|
||||||
if ftp.user != "":
|
if ftp.user != "":
|
||||||
assertReply(ftp.send("USER " & ftp.user), "230", "331")
|
assertReply(ftp.send("USER " & ftp.user), "230", "331")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue