about summary refs log tree commit diff stats
path: root/src/io/posixstream.nim
Commit message (Collapse)AuthorAgeFilesLines
* loader: clean up regular file loadingbptato2024-02-261-1/+0
| | | | | | | | | | | | | | | | | | | | * Get rid of sostream hack This is no longer needed, and was in fact causing loadStream to get stuck with redirects on regular files (i.e. the common case of receiving <file on stdin without a -T content type override). * Unify loading from cache and stdin regular file code paths Until now, loadFromCache was completely sync. This is not a huge problem, but it's better to make it async *and* not have two separate procedures for reading regular files. (In fact, loadFromCache had *another* bug related to its output fd not being added to outputMap.) * Extra: remove ansi2html select error handling It was broken, because it didn't handle read events before the error. Also unnecessary, since recvData breaks from the loop on n == 0.
* Replace Chakasu with Chagashibptato2024-02-221-1/+7
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* Various refactorings & fixesbptato2024-02-141-39/+32
| | | | | | | | * disallow Stream interface usage on non-blocking PosixStreams * do not read estream of forkserver byte-by-byte (it's slow) * do not call writeData with a zero len in formdata * do not quote numbers in mailcap quoteFile * remove some unused stuff
* loader: fix delOutput bug, remove ErrorWouldBlockbptato2024-02-131-4/+1
|
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-0/+6
| | | | | | | | | | | | | | | | | | | | | | | 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.
* loader: fixes & cleanupbptato2024-02-101-1/+8
| | | | | | | | | | | * LoaderHandle.fd is no more, we now check ostream's fd * setBlocking converted to a PosixStream method * SocketStream now sets fd variable * handle sostream/fd redirection properly * fix suspend/resume This fixes non-HTML resource loading, mostly. However, tee is still broken :/
* loader: use recvData instead of readDatabptato2024-02-091-0/+10
| | | | | | | | recvData is a new method for PosixStream that does less weird magic than readData. Also, allow duplicates in unregWrite/unregRead; it's simpler to live with them than to prevent them.
* Incremental renderingbptato2024-02-071-1/+9
| | | | | | | | | | | | Yay! Admittedly, it is not very useful in its current form, except maybe on very slow networks. The problem is that renderDocument is *slow*, so we only run it when onload fails to consume all bytes from the network in a single pass. Even then, we are guaranteed to get a FOUC, since CSS is only downloaded in finishLoad(). Well, I think it's cool, anyway.
* loader: clean up error handlingbptato2024-01-261-0/+3
| | | | | | | | | * remove pointless exception -> bool conversions; usually they were ignored anyway + exceptions are more convenient here * add EPIPE handler to raisePosixIOError * fix socketstream to use raisePosixIOError * fix socketstream sendFileHandle error handling * cgi: immediately return on file not found error
* Use std/* imports everywherebptato2024-01-071-2/+2
|
* buffer: clean up ssock on being killedbptato2023-12-211-0/+3
| | | | | | * use signal handlers to avoid littering tmpdir with dead sockets * add connection reset error (for socketstream) * convert some imports to new style
* posixstream: fix buffer overflowbptato2023-09-281-1/+2
|
* Add mailcap, mime.types & misc refactoringsbptato2023-08-131-0/+5
| | | | | | | | * 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
* Slightly improve request api (less crashes)bptato2023-02-051-1/+4
|
* posixstream: fix incorrect read() usagebptato2023-01-011-1/+1
| | | | It was overwriting our buffer, instead of appending to it...
* posixstream/socketstream: fix cross-platform compilationbptato2022-12-311-8/+17
|
* Fix stream error handling confusion, title displaybptato2022-12-131-8/+25
| | | | Also probably other fixes.
* Add support for the encoding standard, fix parseLegacyColorbptato2022-12-101-0/+40
Also, fix a bug in the