diff options
author | bptato <nincsnevem662@gmail.com> | 2024-01-08 00:37:54 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-01-08 00:37:54 +0100 |
commit | b0547ba9f48bf402665b89f84b88b80ee58d8824 (patch) | |
tree | 39bf645df6ea365f912040255eb136c5deafe2b1 /doc | |
parent | 10a02b2ae2613b383453ba99318330560e9371ac (diff) | |
download | chawan-b0547ba9f48bf402665b89f84b88b80ee58d8824.tar.gz |
Add urlenc, urldec; fix a URL encoding bug; improve trans.cgi
* 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
Diffstat (limited to 'doc')
-rw-r--r-- | doc/localcgi.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/localcgi.md b/doc/localcgi.md index 2d15e6af..206a3ef7 100644 --- a/doc/localcgi.md +++ b/doc/localcgi.md @@ -118,6 +118,9 @@ Chawan sets the following environment variables: * `REQUEST_URI="$SCRIPT_NAME/$PATH_INFO?$QUERY_STRING` * `REQUEST_METHOD=` HTTP method used for making the request, e.g. GET or POST * `REQUEST_HEADERS=` A newline-separated list of all headers for this request. +* `CHA_LIBEXEC_DIR=` The libexec directory Chawan was configured to use at + compile time. See the [tools](#tools) section below for details of + why this is useful. * `CONTENT_TYPE=` for POST requests, the Content-Type header. Not set for other request types (e.g. GET). * `CONTENT_LENGTH=` the content length, if $CONTENT_TYPE has been set. @@ -165,6 +168,18 @@ Note that this may be both an application/x-www-form-urlencoded or a multipart/form-data request; `CONTENT_TYPE` stores information about the request type, and in case of a multipart request, the boundary as well. +## Tools + +Chawan provides certain helper binaries that may be useful for CGI +scripts. These can be portably accessed by executing +`"$CHA_LIBEXEC_DIR"/[program name]`. + +Currently, the following tools are available: + +* `urldec`: percent-decode strings passed on standard input. +* `urlenc`: percent-encode strings passed on standard input, taking a + percent-encode set as the first parameter. + ## Troubleshooting Note that standard error is redirected to the browser console (by default, |