about summary refs log tree commit diff stats
path: root/src/loader/cgi.nim
Commit message (Collapse)AuthorAgeFilesLines
* loader: fix crash on malformed CGI headersbptato2024-03-141-2/+1
| | | | | Setting istream to nil was preventing finishCycle from unregistering & closing it.
* loader: fix nil deref in parseHeadersbptato2024-03-131-1/+1
|
* loader: rework process modelbptato2024-03-111-56/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* cgi: do not eat first word of the error messagebptato2024-03-071-1/+1
| | | | whoops
* cgi: pass system error message after execl failurebptato2024-03-071-1/+2
|
* cgi: fix regression in header handlingbptato2024-03-021-5/+8
| | | | it's a good idea to use the return value, but it must substitute atEnd.
* posixstream: add readLine implementationbptato2024-03-021-6/+4
| | | | | slightly more efficient, but more importantly does not choke on NUL and weird \r\n
* cgi: do not register closed istreamsbptato2024-02-091-1/+2
|
* loader: clean up error handlingbptato2024-01-261-22/+20
| | | | | | | | | * 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
* cgi: fix broken libexec path env variablebptato2024-01-261-6/+5
|
* Add urlenc, urldec; fix a URL encoding bug; improve trans.cgibptato2024-01-081-0/+2
| | | | | | | | | | * Fix incorrect internal definition of the fragment percent-encode set * urlenc, urldec: these are simple utility programs mainly for use with shell local CGI scripts. (Sadly the printf + xargs solution is not portable.) * Pass libexec directory as an env var to local CGI scripts * Update trans.cgi to use urldec and add an example for combining it with selections
* Use std/* imports everywherebptato2024-01-071-5/+5
|
* Compile with styleCheck:usagesbptato2023-12-281-2/+2
| | | | much better
* cgi: return ConnectionError when script is not executablebptato2023-12-211-1/+2
|
* Implement local CGI error message handlingbptato2023-12-151-1/+7
| | | | | | This was documented, but not implemented until now. Also, improve the loader module's protocol documentation.
* Move http out of main binarybptato2023-12-131-17/+15
| | | | | | | | | | | | 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 out ftp: protocol; fix some local CGI bugsbptato2023-12-121-8/+15
|
* Move out file: protocol handling to adapter/bptato2023-12-121-1/+0
|
* local CGI improvements, move data: to cgi-binbptato2023-12-121-14/+82
| | | | error codes are WIP, not final yet...
* local CGI: add mapped URI env vars; move about: to adaptersbptato2023-12-121-3/+16
| | | | | | | | | | | | | | | * Add MAPPED_URI_* as environment variables when a request is coming from urimethodmap It costs us compatibility with w3m, but it seems to be a massive improvement over smuggling in the URL as a query string and then writing an ad-hoc parser for every single urimethodmap script. The variables are set for every urimethodmap request, to avoid accidental leaking of global environment variables. * Move about: to adapters (an obvious improvement over the previous solution)
* Add w3m-cgi-compat optionbptato2023-10-011-1/+5
|
* loader: add local-cgibptato2023-09-301-0/+165
Add w3m-style local CGI support. It is not quite as powerful as w3m's local CGI, because it lacks an equivalent to W3m-control. Not sure if it's worth adding; we certainly shouldn't allow passing JS in headers, but a custom language for headers does not sound like a great idea either... eh, idk. also, TODO add multipart