about summary refs log tree commit diff stats
path: root/src/loader/loaderhandle.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-08 17:39:14 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-08 17:39:14 +0100
commit250cbcfaf6cb57b152659fb9e3c195ef4938adae (patch)
treea653218afce946867f3a8ff644cd372c25d90ad4 /src/loader/loaderhandle.nim
parentcc9ac4d12c1f38029c640ac60fe38a220befa61b (diff)
downloadchawan-250cbcfaf6cb57b152659fb9e3c195ef4938adae.tar.gz
loader: fix eagain in fetch, only add URL to handle in debug
* eagain was causing fetch to add unnecessary null bytes to input
  streams
* URL is now only added to handles in debug mode
Diffstat (limited to 'src/loader/loaderhandle.nim')
-rw-r--r--src/loader/loaderhandle.nim12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/loader/loaderhandle.nim b/src/loader/loaderhandle.nim
index 5d2dee4e..06149e23 100644
--- a/src/loader/loaderhandle.nim
+++ b/src/loader/loaderhandle.nim
@@ -8,7 +8,9 @@ import io/serialize
 import io/socketstream
 import loader/headers
 
-import types/url
+when defined(debug):
+  import types/url
+
 type
   LoaderBufferPage = array[4056, uint8] # 4096 - 8 - 32
 
@@ -32,15 +34,15 @@ type
     currentBuffer*: LoaderBuffer
     currentBufferIdx*: int
     buffers: Deque[LoaderBuffer]
-    url*: URL #TODO TODO TODO debug
+    when defined(debug):
+      url*: URL
 
 # Create a new loader handle, with the output stream ostream.
-proc newLoaderHandle*(ostream: PosixStream, canredir: bool, url: URL): LoaderHandle =
+proc newLoaderHandle*(ostream: PosixStream, canredir: bool): LoaderHandle =
   return LoaderHandle(
     ostream: ostream,
     canredir: canredir,
-    fd: int(SocketStream(ostream).source.getFd()),
-    url: url
+    fd: int(SocketStream(ostream).source.getFd())
   )
 
 func `[]`*(buffer: LoaderBuffer, i: int): var uint8 {.inline.} =