about summary refs log tree commit diff stats
path: root/adapter/protocol
Commit message (Collapse)AuthorAgeFilesLines
* js: refactorbptato2024-05-081-1/+1
| | | | | | | * prefix to-be-separated modules with js * remove dynstreams dependency * untangle from EmptyPromise * move typeptr into tojs
* config: add insecure-ssl-no-verify option to siteconfbptato2024-05-012-0/+5
| | | | | | | Equivalent to curl --insecure. Note: unfortunately this does not help if the server is using unsafe legacy renegotiation, you have to allow that in the OpenSSL config.
* adapter: update code stylebptato2024-04-267-57/+57
|
* ftp: support multiple arguments in ssh config Hostbptato2024-04-261-13/+31
|
* data: replace std/base64 with atobbptato2024-04-251-5/+5
| | | | | | | | | | std's version is known to be broken on versions we still support, and it makes no sense to use different decoders anyway. (This does introduce a bit of a dependency hell, because js/base64 depends on js/javascript which tries to bring in the entire QuickJS runtime. So we move that out into twtstr, and manually convert a Result[string, string] to DOMException in js/base64.)
* http: fix sandbox violation in readFromStdinbptato2024-04-191-3/+3
| | | | | | | | | glibc apparently calls fstat from fread, and we didn't allow it in seccomp. So: * allow fstat in the sandbox; no reason not to, and it seems too big of a footgun to assume we never call fread * use read(2) in http; no need for buffered i/o here
* ftp: fix quoting bugbptato2024-04-091-0/+1
|
* sandbox: add OpenBSD pledge/unveil supportbptato2024-04-031-1/+1
| | | | | | | | | | | | pledge is a bit more fine-grained than Capsicum's capability mode, so the buffer & http ("network") sandboxes are now split up into two parts. I applied the same hack as in FreeBSD for overriding the buffer selector kqueue, because a) I didn't want to request sysctl promise b) I'm not sure if it would even work and c) if it breaks on OpenBSD, then it's broken on FreeBSD too, so there's a greater chance of discovering the bug.
* man: fix command path manpage linksbptato2024-03-311-5/+6
| | | | isCommand was completely broken
* http: suppress proxy connect headersbptato2024-03-292-0/+2
| | | | causes problems with header parsing
* http: fix broken early hint handlingbptato2024-03-281-1/+2
| | | | | | | | | | | The empty string comparison here was in fact pointless; in cw-out.c, libcurl only calls cwb (which is curlWriteHeader in this case) if blen is not 0, so the string will never be empty. (Instead, it is expected to be \r\n; I've added \n too since CGI can already parse headers like that.) Normally it still worked because we just passed through the line to cgi.nim. However, it choked horribly on HTTP/2 early hints.
* Add capsicum supportbptato2024-03-281-0/+2
| | | | | | | | | | | | | It's the sandboxing system of FreeBSD. Quite pleasant to work with. (Just trying to figure out the basics with this one before tackling the abomination that is seccomp.) Indeed, the only non-trivial part was getting newSelector to work with Capsicum. Long story short it doesn't, so we use an ugly pointer cast + assignment. But even that is stdlib's "fault", not Capsicum's. This also gets rid of that ugly SocketPath global.
* libregexp: update LRE_FLAG_UTF16 namebptato2024-03-211-1/+1
| | | | upstream now calls it unicode
* ftp: basic sftp supportbptato2024-03-214-36/+128
| | | | | | | it still sucks, but it is at least slightly more usable. this also fixes a bug in dirlist where sort would mess up item name association
* man: improve processBackspace underscore handlingbptato2024-03-191-2/+6
| | | | | | it is best to base our interpretation of ^H_ on the current formatting, because a) it works predictably well on man output and b) a formatting mismatch results in manRe malfunctioning
* man: better error handlingbptato2024-03-171-35/+89
| | | | | | The "redirect stderr to stdout" scheme broke with groff/man-db, as it was spitting out warnings during execution. So now we handle stderr and stdout separately.
* data: content type fixesbptato2024-03-151-7/+5
| | | | | | | * do not skip first 5 chars (this is legacy from when we used query strings) * allow practically anything but control chars (so we can use parameters)
* man: improve header/footer conversionbptato2024-03-151-4/+11
| | | | | | | * run processBackspace on the first line, because groff likes to print formatting there too * check man references like SAMEPAGE(1) with isCommand because it's commonly found in footers
* man: work around parameter insanitybptato2024-03-151-6/+18
| | | | | | | | | | | | | | | | | | | | | This is horrible. -s means completely different things on various systems. -l does not exist on various systems. Nothing is standardized, except that man should take at least one parameter and that -k should perform a search. (Seriously, that's all.) So what we do is: * add a separate env var for overriding apropos * for man:, never use -s to specify sections * for man-k:, fall back to man, EXCEPT on FreeBSD which does not have a working section specifier on man -k (neither -S nor MANSECT does anything) * for man-l:, just pass the path wholesale to man and hope it does something useful. Also, we now set MANCOLOR to 1 so FreeBSD man gives us formatting as well.
* man: misc improvementsbptato2024-03-141-59/+71
| | | | | | | * do not use query string for arguments * accept symlinks as man binaries * improve error message reporting * run all regexes on the original line
* man: rewrite in Nimbptato2024-03-132-258/+308
| | | | | | | | | | | | Depending on Perl just for this is silly. Now we use libregexp for filtering basically the same things as w3mman2html did. This required another patch to QuickJS to avoid pulling in the entire JS engine, but in return, we can now run regexes without a dummy JS context global variable. Also, man.nim now tries to find a man command on the system even if it's not in /usr/bin/man.
* loader: rework process modelbptato2024-03-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* man: use /usr/bin/env perl shebangbptato2024-03-071-1/+1
| | | | or it breaks on BSD
* http: do not use buffered stdiobptato2024-03-021-6/+9
| | | | | | | buffering output kind of defeats the purpose of the entire loader select machinery (we don't buffer streams either for the same reason)
* gmifetch: clean up globalsbptato2024-02-161-30/+21
|
* gmifetch: set port separatelybptato2024-02-161-17/+15
|
* gmifetch: clean up URL handlingbptato2024-02-161-120/+91
| | | | | | extract_hostname is no more, hooray. + add standard error reporting
* twtstr: misc refactoringsbptato2024-02-091-1/+1
| | | | | | * move out half width <-> full width converters * snake_case -> camelCase * improve toScreamingSnakeCase slicing
* man: fix man -kbptato2024-01-271-20/+37
|
* Add mancha man page viewerbptato2024-01-261-0/+241
| | | | | | | | | | derived from w3mman2html.cgi, there are only a few minor differences: * different man page opener command * use man:, man-k:, man-l: instead of query string to specify action * no form input (C-lC-uman:pageC-m is faster anyway) TODO rewrite in Nim so we don't have to depend on Perl...
* about: fix compilation error on Nim 1.14bptato2024-01-061-1/+4
|
* cha-finger: skip leading slash in pathbptato2024-01-031-1/+1
|
* Add spartan supportbptato2024-01-031-0/+47
| | | | why not
* file: remove symlink codebptato2023-12-211-19/+4
| | | | It was never reached anyway.
* file: do not use streamsbptato2023-12-211-23/+19
|
* Fix compilation on Nim 1.6.14bptato2023-12-165-5/+16
|
* about: actually error out on errorbptato2023-12-151-5/+8
|
* cha-finger: proper error message outputbptato2023-12-151-6/+12
|
* ftp: fix unnecessary slashes being added to path; move bindings/curlbptato2023-12-156-26/+461
| | | | also in ftp: clean up resources before exit
* file: complain about hostnamebptato2023-12-141-0/+5
| | | | fixes error on reloading stdin
* Various fixesbptato2023-12-135-37/+62
| | | | | | | * Makefile: fix parallel build, add new binaries to install target * twtstr: split out libunicode-related stuff to luwrap * config: quote default gopher2html URL env var for unquote * adapter/: get rid of types/url dependency, use CURL url in all cases
* http: use CURLU for URLsbptato2023-12-132-2/+23
|
* 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-138-32/+236
| | | | | | | | | | | | 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
* Move gopher to adapter/bptato2023-12-121-0/+113
| | | | Also, move default urimethodmap config to res.
* Move out ftp: protocol; fix some local CGI bugsbptato2023-12-121-0/+193
|
* Move out file: protocol handling to adapter/bptato2023-12-121-0/+111
|
* adapter/: re-structurebptato2023-12-124-0/+770