about summary refs log tree commit diff stats
path: root/src/buffer/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-05-14 13:44:59 +0200
committerbptato <nincsnevem662@gmail.com>2023-05-14 13:44:59 +0200
commitb080ed197b1f027aa6f400840a4136d1451f9624 (patch)
tree91345ea92921c60326287a5c3096f46e264a9b59 /src/buffer/buffer.nim
parent58dee598d30c5d107f9c469eb01c660b39832f9a (diff)
downloadchawan-b080ed197b1f027aa6f400840a4136d1451f9624.tar.gz
Name negative response codes
Diffstat (limited to 'src/buffer/buffer.nim')
-rw-r--r--src/buffer/buffer.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index bb255f14..2d93214a 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -568,6 +568,7 @@ proc loadResources(buffer: Buffer, document: Document): EmptyPromise =
   return all(promises)
 
 type ConnectResult* = object
+  invalid*: bool
   code*: int
   needsAuth*: bool
   redirect*: Request
@@ -577,7 +578,7 @@ type ConnectResult* = object
 
 proc setupSource(buffer: Buffer): ConnectResult =
   if buffer.connected:
-    result.code = -2
+    result.invalid = true
     return
   let source = buffer.source
   let setct = source.contenttype.isNone
@@ -586,11 +587,12 @@ proc setupSource(buffer: Buffer): ConnectResult =
   buffer.url = source.location
   case source.t
   of CLONE:
+    #TODO clone should probably just fork() the buffer instead.
     let s = connectSocketStream(source.clonepid, blocking = false)
     buffer.istream = s
     buffer.fd = cast[int](s.source.getFd())
     if buffer.istream == nil:
-      result.code = -2
+      result.code = ERROR_SOURCE_NOT_FOUND
       return
     if setct:
       buffer.contenttype = "text/plain"