mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-01-21 00:39:32 +00:00
X
This commit is contained in:
parent
0035f4fa66
commit
d95c875361
@ -970,7 +970,8 @@ proc getResponse(req: HttpClientRequestRef): Future[HttpClientResponseRef] {.
|
|||||||
bytesRead =
|
bytesRead =
|
||||||
try:
|
try:
|
||||||
await req.connection.reader.readUntil(addr buffer[0],
|
await req.connection.reader.readUntil(addr buffer[0],
|
||||||
len(buffer), HeadersMark).wait(
|
len(buffer), HeadersMark,
|
||||||
|
withLogs = true).wait(
|
||||||
req.session.headersTimeout)
|
req.session.headersTimeout)
|
||||||
except AsyncTimeoutError:
|
except AsyncTimeoutError:
|
||||||
raiseHttpReadError("Reading response headers timed out")
|
raiseHttpReadError("Reading response headers timed out")
|
||||||
|
@ -492,7 +492,7 @@ proc readOnce*(rstream: AsyncStreamReader, pbytes: pointer,
|
|||||||
return count
|
return count
|
||||||
|
|
||||||
proc readUntil*(rstream: AsyncStreamReader, pbytes: pointer, nbytes: int,
|
proc readUntil*(rstream: AsyncStreamReader, pbytes: pointer, nbytes: int,
|
||||||
sep: seq[byte]): Future[int] {.async.} =
|
sep: seq[byte], withLogs = false): Future[int] {.async.} =
|
||||||
## Read data from the read-only stream ``rstream`` until separator ``sep`` is
|
## Read data from the read-only stream ``rstream`` until separator ``sep`` is
|
||||||
## found.
|
## found.
|
||||||
##
|
##
|
||||||
@ -514,6 +514,9 @@ proc readUntil*(rstream: AsyncStreamReader, pbytes: pointer, nbytes: int,
|
|||||||
if nbytes == 0:
|
if nbytes == 0:
|
||||||
raise newAsyncStreamLimitError()
|
raise newAsyncStreamLimitError()
|
||||||
|
|
||||||
|
if withLogs:
|
||||||
|
echo "isNil(rstream.rsource) = " & $isNil(rstream.rsource) &
|
||||||
|
" <--> isNil(rstream.readerLoop) = " & $isNil(rstream.readerLoop)
|
||||||
if isNil(rstream.rsource):
|
if isNil(rstream.rsource):
|
||||||
try:
|
try:
|
||||||
return await readUntil(rstream.tsource, pbytes, nbytes, sep)
|
return await readUntil(rstream.tsource, pbytes, nbytes, sep)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user