diff options
author | bptato <nincsnevem662@gmail.com> | 2023-05-14 13:44:59 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-05-14 13:44:59 +0200 |
commit | b080ed197b1f027aa6f400840a4136d1451f9624 (patch) | |
tree | 91345ea92921c60326287a5c3096f46e264a9b59 /src/buffer | |
parent | 58dee598d30c5d107f9c469eb01c660b39832f9a (diff) | |
download | chawan-b080ed197b1f027aa6f400840a4136d1451f9624.tar.gz |
Name negative response codes
Diffstat (limited to 'src/buffer')
-rw-r--r-- | src/buffer/buffer.nim | 6 | ||||
-rw-r--r-- | src/buffer/container.nim | 2 |
2 files changed, 5 insertions, 3 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" diff --git a/src/buffer/container.nim b/src/buffer/container.nim index 7dfd26b9..118bb57d 100644 --- a/src/buffer/container.nim +++ b/src/buffer/container.nim @@ -695,7 +695,7 @@ proc load(container: Container) = container.setLoadInfo("Connecting to " & container.location.host & "...") container.iface.connect().then(proc(res: ConnectResult): auto = let info = container.loadinfo - if res.code != -2: + if not res.invalid: container.code = res.code if res.code == 0: container.triggerEvent(SUCCESS) |