From d95c8753612b7631c8d722832c63634a72aff79f Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Thu, 24 Aug 2023 00:59:30 +0200 Subject: [PATCH] X --- chronos/apps/http/httpclient.nim | 3 ++- chronos/streams/asyncstream.nim | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/chronos/apps/http/httpclient.nim b/chronos/apps/http/httpclient.nim index 311ff1bb..14f34a30 100644 --- a/chronos/apps/http/httpclient.nim +++ b/chronos/apps/http/httpclient.nim @@ -970,7 +970,8 @@ proc getResponse(req: HttpClientRequestRef): Future[HttpClientResponseRef] {. bytesRead = try: await req.connection.reader.readUntil(addr buffer[0], - len(buffer), HeadersMark).wait( + len(buffer), HeadersMark, + withLogs = true).wait( req.session.headersTimeout) except AsyncTimeoutError: raiseHttpReadError("Reading response headers timed out") diff --git a/chronos/streams/asyncstream.nim b/chronos/streams/asyncstream.nim index 9920fc7c..c3b052c3 100644 --- a/chronos/streams/asyncstream.nim +++ b/chronos/streams/asyncstream.nim @@ -492,7 +492,7 @@ proc readOnce*(rstream: AsyncStreamReader, pbytes: pointer, return count 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 ## found. ## @@ -514,6 +514,9 @@ proc readUntil*(rstream: AsyncStreamReader, pbytes: pointer, nbytes: int, if nbytes == 0: raise newAsyncStreamLimitError() + if withLogs: + echo "isNil(rstream.rsource) = " & $isNil(rstream.rsource) & + " <--> isNil(rstream.readerLoop) = " & $isNil(rstream.readerLoop) if isNil(rstream.rsource): try: return await readUntil(rstream.tsource, pbytes, nbytes, sep)