Async httpclient should now work. Changed recv behaviour.
asyncdispatch.recv no longer guarantees that it will read ALL the data requested. The underlying WinAPI function doesn't guarantee this and it already wasn't guaranteed anyway since the socket could disconnect mid-transmission.
This commit is contained in:
parent
62a10df765
commit
4399895d2e
3 changed files with 71 additions and 35 deletions
|
|
@ -116,7 +116,8 @@ proc recvLine*(socket: PAsyncSocket): PFuture[string] {.async.} =
|
|||
if c == "\r":
|
||||
c = await recv(socket, 1, MSG_PEEK)
|
||||
if c.len > 0 and c == "\L":
|
||||
discard await recv(socket, 1)
|
||||
let dummy = await recv(socket, 1)
|
||||
assert dummy == "\L"
|
||||
addNLIfEmpty()
|
||||
return
|
||||
elif c == "\L":
|
||||
|
|
@ -148,7 +149,7 @@ when isMainModule:
|
|||
TestCases = enum
|
||||
HighClient, LowClient, LowServer
|
||||
|
||||
const test = LowServer
|
||||
const test = HighClient
|
||||
|
||||
when test == HighClient:
|
||||
proc main() {.async.} =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue