Merge branch 'patch-1' of https://github.com/acidvertigo/Nim into acidvertigo-patch-1
This commit is contained in:
commit
d67e93340a
2 changed files with 15 additions and 1 deletions
|
|
@ -79,7 +79,12 @@ proc connect*(ftp: AsyncFtpClient) {.async.} =
|
||||||
# 120 Service ready in nnn minutes.
|
# 120 Service ready in nnn minutes.
|
||||||
# We wait until we receive 220.
|
# We wait until we receive 220.
|
||||||
reply = await ftp.expectReply()
|
reply = await ftp.expectReply()
|
||||||
|
|
||||||
|
# Handle 220 messages from the server
|
||||||
assertReply(reply, "220")
|
assertReply(reply, "220")
|
||||||
|
while reply[3] == "-": # handle multiline 220 message
|
||||||
|
assertReply(reply, "220")
|
||||||
|
reply = await ftp.expectReply()
|
||||||
|
|
||||||
if ftp.user != "":
|
if ftp.user != "":
|
||||||
assertReply(await(ftp.send("USER " & ftp.user)), "230", "331")
|
assertReply(await(ftp.send("USER " & ftp.user)), "230", "331")
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,17 @@ 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()
|
||||||
|
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
|
||||||
assertReply ftp.expectReply(), "220"
|
assertReply ftp.expectReply(), "220"
|
||||||
|
while reply[3] == "-": # handle multiline 220 message
|
||||||
|
assertReply ftp.expectReply(), "220"
|
||||||
|
reply = 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