about summary refs log tree commit diff stats
path: root/src/config/mailcap.nim
Commit message (Collapse)AuthorAgeFilesLines
* pager: edit source fixesbptato2024-03-301-44/+48
| | | | | | | * URI-decode path name for local files in default config * (ab)use mailcap command quoting for passing params to editor command instead of replicating it badly in formatEditorName * rename mailcap enums
* ansi2html: support passing titlesbptato2024-03-291-0/+1
| | | | | | | Use content type attributes so e.g. git.cgi can set the title even with a text/x-ansi content type. (This commit also fixes some bugs in content type attribute handling.)
* loader: remove applyHeadersbptato2024-03-121-41/+18
| | | | | | | Better compute the values we need on-demand at the call sites; this way, we can pass through content type attributes to mailcap too. (Also, remove a bug where applyResponse was called twice.)
* mailcap: better error messages, accept \ as newline escapebptato2024-03-111-6/+18
| | | | the backslash thing is in the RFC, I just forgot to add it
* loader: rework process modelbptato2024-03-111-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Separate ANSI text decoding from main binarybptato2024-02-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling text/plain as ANSI colored text was problematic for two reasons: * You couldn't actually look at the real source of HTML pages or text files that used ANSI colors in the source. In general, I only want ANSI colors when piping something into my pager, not when viewing any random file. * More importantly, it introduced a separate rendering mode for plaintext documents, which resulted in the problem that only some buffers had DOMs. This made it impossible to add functionality that would operate on the buffer's DOM, to e.g. implement w3m's MARK_URL. Also, it locked us into the horribly inefficient line-based rendering model of entire documents. Now we solve the problem in two separate parts: * text/x-ansi is used automatically for documents received through stdin. A text/x-ansi handler ansi2html converts ANSI formatting to HTML. text/x-ansi is also used for .ans, .asc file extensions. * text/plain is a separate input mode in buffer, which places all text in a single <plaintext> tag. Crucially, this does not invoke the HTML parser; that would eat NUL characters, which we should avoid. One blind spot still remains: copiousoutput used to display ANSI colors, and now it doesn't. To solve this, users can put the x-ansioutput extension field to their mailcap entries, which behaves like x-htmloutput except it first pipes the output into ansi2html.
* Replace Chakasu with Chagashibptato2024-02-221-1/+1
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* Various refactorings & fixesbptato2024-02-141-4/+3
| | | | | | | | * 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
* config: append */* rule instead of prependingbptato2024-01-301-8/+0
| | | | | | + actually use the result. Fixes default converters when no external mailcap exists.
* Use std/* imports everywherebptato2024-01-071-3/+3
|
* twtstr: remove tolower, isWhitespacebptato2023-11-201-3/+3
| | | | | | | | * tolower: strutils toLowerAscii is good enough for the cases where we need it. Also, it's easy to confuse with unicode toLower and vice versa. * isWhitespace: in AsciiWhitespace is more idiomatic. Also has a naming collision with unicode toLower.
* mailcap: fix regressionbptato2023-09-161-1/+1
| | | | not that this code path is ever executed
* mailcap: unquoteCommand improvements/fixesbptato2023-09-161-34/+57
| | | | | | | | * quote substituted URLs, mime types and named attributes too * change quote state: now we use a stack of quote states, new states are pushed/popped when a process substitution is encountered * fix named attribute state (it was incomplete) * remove superfluous tolower statements
* mailcap: allow whitespace after subtypebptato2023-09-161-1/+1
|
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* mailcap: fix newline parsingbptato2023-08-261-1/+1
| | | | skipBlanks should not consume newlines.
* Move charsets into chakasubptato2023-08-141-1/+2
| | | | Operation "modularize Chawan somewhat" part 1
* Simplify mailcap entry matchingbptato2023-08-131-25/+14
|
* Add mailcap, mime.types & misc refactoringsbptato2023-08-131-0/+342
* 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