Proper handling of disconnections during reading in httpclient.
This commit is contained in:
parent
4399895d2e
commit
5a4afbef84
1 changed files with 3 additions and 1 deletions
|
|
@ -453,7 +453,9 @@ proc recvFull(socket: PAsyncSocket, size: int): PFuture[string] {.async.} =
|
||||||
result = ""
|
result = ""
|
||||||
while true:
|
while true:
|
||||||
if size == result.len: break
|
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.} =
|
proc parseChunks(client: PAsyncHttpClient): PFuture[string] {.async.} =
|
||||||
result = ""
|
result = ""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue