diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-12 17:03:35 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-12 17:03:35 +0100 |
commit | 8e6783a45fba48dd8f63fe7486e4691f05220b52 (patch) | |
tree | 5aae9f9f95432609a497eea858c4a3401dac172b /src/types | |
parent | 69b1a7e7f6e0a675cd70805768162de5621e8279 (diff) | |
download | chawan-8e6783a45fba48dd8f63fe7486e4691f05220b52.tar.gz |
Remove CLONE BufferSource; cache document sources in tmpdir
At last all BufferSources are unified. To achieve the same effect as the previous CLONE source type, we now use the "fromcache" flag in Request. This *forces* the document to be streamed from the disk; if the file no longer exists for some reason, an error is returned (i.e. the document is not re-downloaded). For a document to be cached, it has to be the main document of the buffer (i.e. no additional resources requested with fetch()), and also not an x-htmloutput HTML file (for those, the original source is saved). The result is that toggleSource now always returns the actual source for e.g. markdown files, not the HTML-transformed version. Also, it is now possible to view the source of a document that is still being downloaded. buffer.sstream has almost been eliminated; it still exists, but only as a pseudo-buffer to interface with EncoderStream and DecoderStream. It no longer holds the entire source of a buffer at any point, and is cleared as soon as the buffer is completely loaded.
Diffstat (limited to 'src/types')
-rw-r--r-- | src/types/buffersource.nim | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/types/buffersource.nim b/src/types/buffersource.nim index 6377464e..675d2a2a 100644 --- a/src/types/buffersource.nim +++ b/src/types/buffersource.nim @@ -1,23 +1,13 @@ import std/options -when defined(posix): - import std/posix - import loader/request import types/url import chakasu/charset type - BufferSourceType* = enum - CLONE, LOAD_REQUEST - BufferSource* = object location*: URL contentType*: Option[string] # override charset*: Charset # fallback - case t*: BufferSourceType - of CLONE: - clonepid*: Pid - of LOAD_REQUEST: - request*: Request + request*: Request |