about summary refs log tree commit diff stats
path: root/adapter
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-11 19:15:24 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-11 21:09:52 +0100
commitb789b0b076ef7aba3f5f6bbb4f6b7cadf596994c (patch)
tree388a265fd778cd8fc3e9fad9d734628aca0bd287 /adapter
parent8bf82ddbfb84b5ca32824a466380dae4df4ff31a (diff)
downloadchawan-b789b0b076ef7aba3f5f6bbb4f6b7cadf596994c.tar.gz
loader: rework process model
Originally we had several loader processes so that the loader did not
need asynchronity for loading several buffers at once. Since then, the
scope of what loader does has been reduced significantly, and with
that loader has become mostly asynchronous.

This patch finishes the above work as follows:

* We only fork a single loader process for the browser. It is a waste of
  resources to do otherwise, and would have made future work on a
  download manager very difficult.

* loader becomes (almost) fully async. Now the only sync part is a)
  processing commands and b) waiting for clients to consume responses.
  b) is a bit more problematic than a), but should not cause problems
  unless some other horrible bug exists in a client. (TODO: make it
  fully async.)
  This gives us a noticable improvement in CSS loading speed, since all
  resources can now be queried at once (even before the previous ones
  are connected).

* Buffers now only get processes when the *connection* is finished. So
  headers, status code, etc. are handled by the client, and the buffer
  is forked when the loader starts streaming the response body.
  As a result, mailcap entries can simply dup2 the first UNIX domain
  socket connection as their stdin. This allows us to remove the ugly
  (and slow) `canredir' hack, which required us to send file handles on
  a tour accross the entire codebase.

* The "cache" has been reworked somewhat:
	- Since canredir is gone, buffer-level requests usually start
	  in a suspended state, and are explicitly resumed only after
	  the client could decide whether it wants to cache the response.
	- Instead of a flag on Request and the URL as the cache key,
	  we now use a global counter and the special `cache:' scheme.

* misc fixes: referer_from is now actually respected by buffers (not
  just the pager), load info display should work slightly better, etc.
Diffstat (limited to 'adapter')
-rw-r--r--adapter/format/ansi2html.nim2
-rw-r--r--adapter/protocol/ftp.nim1
2 files changed, 1 insertions, 2 deletions
diff --git a/adapter/format/ansi2html.nim b/adapter/format/ansi2html.nim
index dbb3faab..fe8deef4 100644
--- a/adapter/format/ansi2html.nim
+++ b/adapter/format/ansi2html.nim
@@ -42,7 +42,7 @@ template getParamU8(parser: AnsiCodeParser, i: var int,
     colon = false): uint8 =
   if i >= parser.params.len:
     return false
-  let u = parseUInt8(parser.getParam(i))
+  let u = parseUInt8(parser.getParam(i), allowSign = false)
   if u.isNone:
     return false
   u.get
diff --git a/adapter/protocol/ftp.nim b/adapter/protocol/ftp.nim
index d3a91e96..41c2183f 100644
--- a/adapter/protocol/ftp.nim
+++ b/adapter/protocol/ftp.nim
@@ -11,7 +11,6 @@ import curlwrap
 import dirlist
 
 import loader/connecterror
-import types/opt
 import utils/twtstr
 
 type FtpHandle = ref object