diff options
Diffstat (limited to 'lib/pure/asyncftpclient.nim')
-rw-r--r-- | lib/pure/asyncftpclient.nim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/pure/asyncftpclient.nim b/lib/pure/asyncftpclient.nim index 5bf0c240d..32e0f9636 100644 --- a/lib/pure/asyncftpclient.nim +++ b/lib/pure/asyncftpclient.nim @@ -141,7 +141,7 @@ proc expectReply(ftp: AsyncFtpClient): Future[string] {.async.} = while line.len > 3 and line[3] == '-': ## Multi-line reply. line = await ftp.csock.recvLine() - string(result).add("\n" & line) + result.add("\n" & line) count.inc() if count >= multiLineLimit: raise newException(ReplyError, "Reached maximum multi-line reply count.") @@ -163,7 +163,7 @@ proc assertReply(received: string, expected: varargs[string]) = if received.startsWith(i): return raise newException(ReplyError, "Expected reply '$1' got: $2" % - [expected.join("' or '"), received.string]) + [expected.join("' or '"), received]) proc pasv(ftp: AsyncFtpClient) {.async.} = ## Negotiate a data connection. @@ -171,7 +171,7 @@ proc pasv(ftp: AsyncFtpClient) {.async.} = var pasvMsg = (await ftp.send("PASV")).strip assertReply(pasvMsg, "227") - var betweenParens = captureBetween(pasvMsg.string, '(', ')') + var betweenParens = captureBetween(pasvMsg, '(', ')') var nums = betweenParens.split(',') var ip = nums[0 .. ^3] var port = nums[^2 .. ^1] @@ -187,7 +187,7 @@ proc connect*(ftp: AsyncFtpClient) {.async.} = await ftp.csock.connect(ftp.address, ftp.port) var reply = await ftp.expectReply() - if string(reply).startsWith("120"): + if reply.startsWith("120"): # 120 Service ready in nnn minutes. # We wait until we receive 220. reply = await ftp.expectReply() @@ -221,10 +221,10 @@ proc getLines(ftp: AsyncFtpClient): Future[string] {.async.} = assert ftp.dsockConnected while ftp.dsockConnected: let r = await ftp.dsock.recvLine() - if r.string == "": + if r == "": ftp.dsockConnected = false else: - result.add(r.string & "\n") + result.add(r & "\n") assertReply(await(ftp.expectReply()), "226") @@ -346,10 +346,10 @@ proc retrFile*(ftp: AsyncFtpClient, file, dest: string, await ftp.pasv() var reply = await ftp.send("RETR " & file.normalizePathSep) assertReply reply, ["125", "150"] - if {'(', ')'} notin reply.string: + if {'(', ')'} notin reply: raise newException(ReplyError, "Reply has no file size.") var fileSize: BiggestInt - if reply.string.captureBetween('(', ')').parseBiggestInt(fileSize) == 0: + if reply.captureBetween('(', ')').parseBiggestInt(fileSize) == 0: raise newException(ReplyError, "Reply has no file size.") await getFile(ftp, destFile, fileSize, onProgressChanged) |