about summary refs log tree commit diff stats
path: root/src/io
Commit message (Collapse)AuthorAgeFilesLines
* reduce new() usagebptato2023-10-252-8/+9
|
* Remove runestreambptato2023-10-221-31/+0
| | | | unused
* socketstream: get rid of pointer arithmeticbptato2023-10-181-2/+4
|
* posixstream: fix buffer overflowbptato2023-09-281-1/+2
|
* 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.)
* buffer: make clone fork()bptato2023-09-232-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes e.g. on-page anchor navigation near-instantaneous. Well, as instantaneous as a fork can be. In any case, it's a lot faster than loading the entire page anew. This involves duplicating open resources (file descriptors, etc.), which is not exactly trivial. For now we have a huge clone() procedure that does an ok-ish job at it, but there remains a lot of room for improvement. e.g. cloning is still broken in some cases: * As noted in the comments, TeeStream'ing the input stream for any buffer is a horrible idea, as readout in the cloned buffer now depends on the original buffer also reading from the stream. (So e.g. if you clone, then kill the old buffer without waiting for the new one to load, the new buffer gets stuck.) * Timeouts/intervals are broken in cloned buffers. The timeout module probably needs a redesign to fix this. * If you clone before connect2, the cloned buffer gets stuck. The previous solution was even worse (i.e. broken in more cases), so this is still an improvement. For example, this fixes some issues with mailcap handling (removes the "set the Content-Type of htmloutput buffers to text/html" hack), does not reload all resources, does not completely break if the buffer is cloned during loading, etc.
* 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-1417-1753/+620
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* remove obsolete commentbptato2023-09-091-1/+0
|
* fetch: use JSDictbptato2023-09-092-43/+136
|
* loader: get rid of xdeclaredbutnotused warningbptato2023-09-071-0/+1
| | | | | sig is injected into the template body, but then never used, so we discard it.
* Fix compilation < Nim 2.0bptato2023-09-041-1/+1
| | | | Before Nim 2.0, addr could only be used with mutable variables.
* loader, data: remove stray eprintsbptato2023-09-022-4/+0
|
* loader: add data URLsbptato2023-09-014-5/+66
|
* javascript: factor out fromJSbptato2023-08-292-0/+2
|
* refactor: Result[T, JSError] -> JSResult[T]bptato2023-08-282-8/+7
|
* javascript: refactorbptato2023-08-283-4/+7
| | | | | | | Split out parts of the JS module, because it was starting to confuse the compiler a little. (Peakmem is back at 750M. Interesting.)
* Move charsets into chakasubptato2023-08-143-5/+8
| | | | Operation "modularize Chawan somewhat" part 1
* Add mailcap, mime.types & misc refactoringsbptato2023-08-1310-164/+302
| | | | | | | | * add mailcap: works with copiousoutput, needsterminal, etc. * add mime.types (only works with mailcap) * refactor pipeBuffer * remove "dispatcher" * fix bug in directory display where baseurl would not be used
* Fixes & workarounds to compile on Nim 2.0.0bptato2023-08-012-1/+4
| | | | | | | | | | | | | | * Import punycode, as it has been removed from stdlib. * Fix some syntax errors * Apparently you can no longer compare distinct pointers with nil. Add explicit comparisons with typeof(nil) instead. * htmlparser: rename _ to other, as semantics of _ have changed. (Quite a shame, it looked better with _. Oh well.) * Explicitly specify mm:refc, as the browser OOMs with orc for some reason. Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8. (<1.6.8 it's broken & wontfix.)
* Improve encoding supportbptato2023-07-122-33/+63
| | | | | | | | * Use the output charset in lineedit (as w3m does) * encoder: fix broken UTF-8 encoding, use openArray instead of var seq for input queue * Add RuneStream as an in-memory interface to EncoderStream * Document display-charset config option
* Buffer search fixes & improvementsbptato2023-07-111-9/+17
| | | | | * Fix race condition in updateReadLineISearch * Disable reshape during isearch
* Add proxy supportbptato2023-07-041-0/+6
|
* Add platform object conversion to union typebptato2023-07-022-17/+48
| | | | And with that, implement Request constructor with a Request init.
* return Result[T, JSError] from fromJSbptato2023-07-023-8/+6
|
* Factor out headers into separate modulebptato2023-07-017-59/+70
|
* use =destroy instead of finalizersbptato2023-07-013-0/+7
| | | | | This should help with moving to ORC in the future. (Also, finalizers do not work very well in the first place.)
* Factor out map search, remove sugarbptato2023-06-291-2/+10
|
* Support 8-bit output colorsbptato2023-06-261-1/+1
|
* hacks for readline so that it at least kind of worksbptato2023-06-251-2/+9
| | | | Proper fix needed later
* Do not allow text() twice, etc...bptato2023-06-202-7/+24
|
* Add Response.ok, url, fix type confusion with statusbptato2023-06-193-7/+17
|
* Reject fetch promise on network errorbptato2023-06-192-8/+10
| | | | Instead of setting the non-standard res variable.
* Get rid of the .jserr pragmabptato2023-06-191-10/+8
|
* Rework JS exception systembptato2023-06-194-13/+31
| | | | | Now we use Result for passing exceptions to JS. As a result, we can finally get rid of the .jserr pragma.
* Cleanups & bug fixes involving promisesbptato2023-06-155-69/+115
| | | | | Now a promise returning nil doesn't just leave the rest of the then chain hanging. Hooray.
* Make Result.text, json return promisebptato2023-06-133-16/+62
|
* Add indexed color, other png improvementsbptato2023-06-091-1/+1
|
* Simplify request.json, remove unused bindingsbptato2023-06-091-13/+4
|
* Show error messages, fix some fetch crashesbptato2023-06-092-0/+9
|
* Remove JSObject again, add File API constructorbptato2023-06-081-4/+6
|
* Fix bug in client's unregistered fd handlingbptato2023-06-061-0/+2
| | | | + run JS jobs after every poll in headless mode
* buffer: call handleError before handleRead & miscbptato2023-06-051-1/+1
|
* Refactor Request constructorbptato2023-06-051-22/+33
|
* Add support for canvas and multipartbptato2023-06-052-39/+32
| | | | | | | | | | | | | | | Quite incomplete canvas implementation. Crucially, the layout engine can't do much with whatever is drawn because it doesn't support images yet. I've re-introduced multipart as well, with the FormData API. For the append function I've also introduced a hack to the JS binding generator that allows requesting the JSContext pointer in nim procs. Really I should just fix the union generator thing and add support for overloading. In conclusion, for now the only thing canvas can be used for is exporting it as PNG and uploading it somewhere. Also, we now have PNG encoding and decoding too. (Now if only we had sixels as well...)
* Rewrite new Request bindingbptato2023-05-215-33/+116
| | | | | Still far from perfect, but now at least it has a bit more to do with what the standard mandates.
* Add url getter to requestbptato2023-05-201-2/+9
|
* Name negative response codesbptato2023-05-141-4/+12
|