about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-07-19 18:12:44 +0200
committerbptato <nincsnevem662@gmail.com>2024-07-19 18:16:12 +0200
commit0d08ee8959d126d652fc42e9af63dbc8cc1d93ba (patch)
tree1b597924989f1eb3e4b96714c69e385af97d7186 /src/local
parentf94b84bde340739647ffe7dd92cfcefb6686eca2 (diff)
downloadchawan-0d08ee8959d126d652fc42e9af63dbc8cc1d93ba.tar.gz
loader: async status/headers for fetch
The status code & headers are no longer guaranteed to be sent right
after res/outputId, so read them asynchronously instead.

(This is pretty much the same code as the buffer connection handler in
pager. Hopefully we can merge the two at some point.)
Diffstat (limited to 'src/local')
-rw-r--r--src/local/pager.nim9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/local/pager.nim b/src/local/pager.nim
index de990767..c77d724b 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -1970,13 +1970,8 @@ proc handleConnectingContainer*(pager: Pager; i: int) =
     inc item.state
     # continue
   of ccsBeforeHeaders:
-    let response = Response(
-      res: item.res,
-      outputId: item.outputId,
-      status: item.status,
-      url: container.request.url,
-      body: stream
-    )
+    let response = newResponse(item.res, container.request, stream,
+      item.outputId, item.status)
     var r = stream.initPacketReader()
     r.sread(response.headers)
     # done