Proper handling of disconnections during reading in httpclient.

This commit is contained in:
Dominik Picheta
2014-04-03 20:06:59 +01:00
parent 4399895d2e
commit 5a4afbef84

View File

@@ -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 = ""