mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 21:40:32 +00:00
Merge branch 'patch-1' of https://github.com/acidvertigo/Nim into acidvertigo-patch-1
This commit is contained in:
@@ -79,7 +79,12 @@ proc connect*(ftp: AsyncFtpClient) {.async.} =
|
||||
# 120 Service ready in nnn minutes.
|
||||
# We wait until we receive 220.
|
||||
reply = await ftp.expectReply()
|
||||
|
||||
# Handle 220 messages from the server
|
||||
assertReply(reply, "220")
|
||||
while reply[3] == "-": # handle multiline 220 message
|
||||
assertReply(reply, "220")
|
||||
reply = await ftp.expectReply()
|
||||
|
||||
if ftp.user != "":
|
||||
assertReply(await(ftp.send("USER " & ftp.user)), "230", "331")
|
||||
|
||||
@@ -263,8 +263,17 @@ proc connect*[T](ftp: FtpBase[T]) =
|
||||
else:
|
||||
{.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"
|
||||
while reply[3] == "-": # handle multiline 220 message
|
||||
assertReply ftp.expectReply(), "220"
|
||||
reply = ftp.expectReply()
|
||||
|
||||
if ftp.user != "":
|
||||
assertReply(ftp.send("USER " & ftp.user), "230", "331")
|
||||
|
||||
Reference in New Issue
Block a user