about summary refs log tree commit diff stats
path: root/src/server/buffer.nim
Commit message (Collapse)AuthorAgeFilesLines
...
* buffer: clean up contentTypebptato2024-02-221-18/+4
| | | | | | | | | | This fixes a bug where setContentType would call setHTML twice, which messed up charsets and probably a couple more things. As a bonus, it allows us to pass around the content type less. In fact, buffer does not have to know its exact content type, just whether it is in HTML mode or not. So that's all we tell it now; only container still keeps track of the content type (as it should).
* Replace Chakasu with Chagashibptato2024-02-221-55/+153
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* buffer: fix broken jump-to-anchorbptato2024-02-181-1/+1
| | | | | source.request.url is not used after buffer initialization (because it may be replaced later), so we must set buffer.url instead.
* layout: use html/body bgcolor as canvas bgcolorbptato2024-02-171-17/+11
| | | | | | This is required by the standard. (Without this, lots of websites have incorrect background colors, because they set the body height to 100% of the viewport.)
* Various refactorings & fixesbptato2024-02-141-26/+20
| | | | | | | | * 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
* buffer: improve style invalidationbptato2024-02-141-5/+5
|
* buffer: fix regression on htmloutput document baseURLbptato2024-02-141-3/+2
| | | | | readFromFd replacing the base URL of the buffer turns out to be a very bad idea.
* buffer: skip rewind after the first readbptato2024-02-131-7/+17
| | | | | Speeds up processing of pretty much all documents, because we rarely need to switch the charset after having downloaded the first chunk.
* loader: fix delOutput bug, remove ErrorWouldBlockbptato2024-02-131-4/+4
|
* loader: fixes & improvementsbptato2024-02-131-21/+18
| | | | | | | | * factor out pushBuffer to make loadFromCache async * fix incorrect cache path * replace rewind with loadFromCache (it does the same thing except actually works) * remove rewindImpl callback, rewind in buffer instead
* buffer: more form fixesbptato2024-02-131-11/+31
|
* buffer: fix wrong click behavior with JSbptato2024-02-131-1/+1
| | | | | do_reshape could move the target element, and thus call click on the wrong clickable.
* buffer: form fixesbptato2024-02-121-16/+10
| | | | | * show submission URL on hover for all form-associated elements * skip non-checked checkbox/radio inputs
* buffersource: remove location fieldbptato2024-02-121-3/+2
|
* Add pager.externFilterSourcebptato2024-02-121-4/+5
| | | | useful for filtering stuff through commands like rdrview
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-118/+93
| | | | | | | | | | | | | | | | | | | | | | | 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-29/+10
| | | | | Instead, use a stream: scheme and associate hostnames with file descriptors directly from the pager.
* loader: fix teebptato2024-02-101-4/+5
| | | | | | | | | | | | My eyes are bleeding, but at least there is a chance that this does what I wanted. The previous tee implementation mixed buffer and loader fds, so it was fundamentally broken. Also, it used MultiStream which makes asynchronous streaming impossible. This time we use a flat array of output handles and link to them any buffers not written to the target yet.
* buffer: fix index defect in updateHoverbptato2024-02-081-1/+2
| | | | | | Caused by a race condition when updateHover is executed after buffer.lines.len changed in buffer but before the change has been reported to container.
* buffer: use `of' instead of tagTypebptato2024-02-081-1/+1
|
* buffer: load external resources when they are attachedbptato2024-02-081-81/+6
| | | | | We no longer have to wait for the entire document to be loaded to start loading CSS.
* dom: enumize attribute namesbptato2024-02-081-8/+9
|
* dom: reduce tagType usebptato2024-02-081-8/+7
| | | | | tagType is now a function call, but usually it's enough to just test for the object type.
* Incremental renderingbptato2024-02-071-55/+69
| | | | | | | | | | | | 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.
* Update chamebptato2024-02-071-26/+52
| | | | | | | | * Update chame to the latest version * Get rid of nodeType usage * Add atoms * Re-implement DOM attributes * document.write
* rendertext: add support for backspace overstrike, misc fixesbptato2024-01-231-1/+1
| | | | | * parse manpage output styled ugly backspace overstrike formatting * fix broken charset detection for large files
* Fix form action when submitter has a "form" attrbptato2024-01-191-3/+4
| | | | | | | * Unify form variable for all form-associated elements * Fix broken form association logic in resetFormOwner * Use form action for all form-associated submitters * Remove unused getElementsByTag + de-extern some functions
* buffer: fix clone on *BSDbptato2024-01-191-1/+8
| | | | kqueue does not like being closed after fork(2).
* Fix windowChange not refreshing valid media queriesbptato2024-01-101-0/+3
| | | | | | | | * css/cascade: copy stylesheet in applyMediaQuery (so that changes are reverted on re-style) * buffer: clear prevstyled in windowChange (to avoid using cached results from previous cascading passes); set window.attrs * pager: avoid windowChange if new attrs are identical to the old ones
* Fix some casing issuesbptato2024-01-061-2/+2
|
* buffer: do not trap SIGINT to cleanupbptato2024-01-031-1/+1
| | | | | | | We trap SIGINT with setControlCHook to avoid buffers being killed by the process group receiving a SIGINT; trapping it to cleanup has the opposite effect. SIGTERM should be enough, as that is what we use for cleaning up buffers.
* Compile with styleCheck:usagesbptato2023-12-281-3/+3
| | | | much better
* buffer: prevent crash in reshape before document is parsedbptato2023-12-221-0/+2
| | | | Can happen e.g. if the window is resized or the user manually reshapes.
* buffer: clean up ssock on being killedbptato2023-12-211-15/+26
| | | | | | * use signal handlers to avoid littering tmpdir with dead sockets * add connection reset error (for socketstream) * convert some imports to new style
* Implement local CGI error message handlingbptato2023-12-151-1/+5
| | | | | | This was documented, but not implemented until now. Also, improve the loader module's protocol documentation.
* buffer: use BufferSize constantbptato2023-12-151-1/+1
|
* break up twtstr somewhatbptato2023-12-131-0/+1
| | | | | Avoid computing e.g. charwidth data for http which does not need it at all.
* Move http out of main binarybptato2023-12-131-6/+6
| | | | | | | | | | | | Now it is (technically) no longer mandatory to link to libcurl. Also, Chawan is at last completely protocol and network backend agnostic :) * Implement multipart requests in local CGI * Implement simultaneous download of CGI data * Add REQUEST_HEADERS env var with all headers * cssparser: add a missing check in consumeEscape
* pager: add precnum to [, ]bptato2023-12-091-9/+23
|
* pager: add `{', `}'; document externIntobptato2023-12-091-1/+20
| | | | | | | | { & } acts like in vi (except the cursor is not moved to the line beginning). No reason to leave externInto undocumented, as it is even used in the default config.
* buffer: do not needlessly copy in onloadbptato2023-12-031-9/+5
|
* dom: fix relList setter regression, remove rel()bptato2023-12-021-1/+1
|
* dom: redefine Node.contains to match standardbptato2023-12-011-1/+1
| | | | (and expose it as a JS function)
* buffer: do not set readyState if document is nilbptato2023-11-291-1/+2
| | | | | As the comment says, buffer.document only exists if buffer.ishtml is true.
* dom: add document.readyStatebptato2023-11-271-2/+4
|
* buffer: add DOMContentLoaded, misc event improvementsbptato2023-11-271-46/+72
| | | | | | | * Add DOMContentLoaded * Re-use the same event object for all elements * Reshape if an event was fired * Reshape on setTimeout/setInterval fired
* buffer: call onload function on dispatchLoadEventbptato2023-11-211-3/+13
|
* buffer: optimize findPrevLinkbptato2023-11-201-0/+8
| | | | | It's better to not do it perfectly in 100% of all cases than to loop through the entire document in all cases.
* buffer: remove viewport referencebptato2023-10-281-7/+1
| | | | | Viewport at this point is basically just the layout state, so it makes no sense to store it in buffer.
* renderdocument: slightly refactor, optimize addLinesbptato2023-10-261-4/+13
|