about summary refs log tree commit diff stats
path: root/adapter/protocol/http.nim
Commit message (Collapse)AuthorAgeFilesLines
* http: remove twtstr dependencybptato2024-10-011-4/+10
|
* stbi, jebp: use read/write instead of fread/fwritebptato2024-08-261-3/+15
| | | | | | | | glibc likes to do weird things (such as calling stat) when you use fread(3) and friends, so try to use functions that are more likely to just do a single syscall. Also, copy over some more paranoid read/write procedures to http.
* buffer, pager, config: add meta-refresh + misc fixesbptato2024-07-281-1/+1
| | | | | | | | | * buffer, pager, config: add meta-refresh value, which makes it possible to follow http-equiv=refresh META tags. * config: clean up redundant format mode parser * timeout: accept varargs for params to pass on to functions * pager: add "options" dict to JS gotoURL * twtstr: remove redundant startsWithNoCase
* http: allow multiple early hintsbptato2024-05-221-1/+1
|
* config: add insecure-ssl-no-verify option to siteconfbptato2024-05-011-0/+3
| | | | | | | 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-261-11/+8
|
* 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
* 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.
* http: suppress proxy connect headersbptato2024-03-291-0/+1
| | | | 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.
* 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)
* Fix compilation on Nim 1.6.14bptato2023-12-161-1/+4
|
* ftp: fix unnecessary slashes being added to path; move bindings/curlbptato2023-12-151-1/+1
| | | | also in ftp: clean up resources before exit
* Various fixesbptato2023-12-131-3/+1
| | | | | | | * 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-131-2/+20
|
* Move http out of main binarybptato2023-12-131-0/+128
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