mirror of
https://github.com/nim-lang/Nim.git
synced 2026-03-02 14:48:31 +00:00
Proper handling of disconnections during reading in httpclient.
This commit is contained in:
@@ -453,7 +453,9 @@ proc recvFull(socket: PAsyncSocket, size: int): PFuture[string] {.async.} =
|
||||
result = ""
|
||||
while true:
|
||||
if size == result.len: break
|
||||
result.add await socket.recv(size - result.len)
|
||||
let data = await socket.recv(size - result.len)
|
||||
if data == "": break # We've been disconnected.
|
||||
result.add data
|
||||
|
||||
proc parseChunks(client: PAsyncHttpClient): PFuture[string] {.async.} =
|
||||
result = ""
|
||||
|
||||
Reference in New Issue
Block a user