about summary refs log tree commit diff stats
path: root/src/io/serialize.nim
Commit message (Collapse)AuthorAgeFilesLines
* io: derive DynStream from RootObj (not Stream)bptato2024-03-241-234/+0
| | | | | | | | This way they are no longer compatible, but we no longer need them to be compatible anyway. (This also forces us to throw out the old serialize module, and use packet writers everywhere.)
* io: add bufreaderbptato2024-03-211-53/+0
| | | | analogous to bufwriter
* io: add BuferedWriterbptato2024-03-161-106/+0
| | | | | | | | | | Unsurprisingly enough, calling `write` a million times is never going to be very fast. BufferedWriter basically does the same thing as serialize.swrite did, but queues up writes in batches before sending them. TODO: give sread a similar treatment
* loader: rework process modelbptato2024-03-111-10/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-37/+0
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Get rid of LOAD_PIPE BufferSourcebptato2024-02-111-5/+0
| | | | | Instead, use a stream: scheme and associate hostnames with file descriptors directly from the pager.
* Use std/* imports everywherebptato2024-01-071-4/+4
|
* Fix some casing issuesbptato2024-01-061-1/+1
|
* Compile with styleCheck:usagesbptato2023-12-281-3/+3
| | | | much better
* reduce new() usagebptato2023-10-251-1/+1
|
* buffer: simplify contentType handlingbptato2023-09-271-3/+3
| | | | | | * remove contentType member of Buffer object * add ishtml to reduce string comparisons * consistent spelling: contenttype -> contentType
* regex: copy after compilingbptato2023-09-241-25/+0
| | | | | | | | | | | | Instead of the broken attempt at making regexes zero-copy (it copied anyway), copy once and forget about it. (There have been way too many problems with the destructor approach, including the latest one where the GC would happily zero out our regexes if they were in a sequence. Maybe we can make this work once we switched to ORC. For now, it's not worth the trouble.)
* response: add blob() functionbptato2023-09-171-2/+3
|
* Fix compilation with --assertions:offbptato2023-09-151-1/+2
| | | | | Remove side effects from assert statements. The flag is not used currently, but let's not depend on that.
* move around more modulesbptato2023-09-141-0/+444
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* Move ips stuff to src/ips/bptato2022-11-221-207/+0
|
* Rewrite buffer/pager for multi-processingbptato2022-11-191-6/+73
|
* Use unix domain sockets for IPCbptato2022-09-061-0/+1
|
* Use a separate process for file loadingbptato2022-08-181-0/+139
Not very useful for now, since we still have to load the entire page before parsing it.