about summary refs log tree commit diff stats
path: root/src/loader/cgi.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-01-08 00:37:54 +0100
committerbptato <nincsnevem662@gmail.com>2024-01-08 00:37:54 +0100
commitb0547ba9f48bf402665b89f84b88b80ee58d8824 (patch)
tree39bf645df6ea365f912040255eb136c5deafe2b1 /src/loader/cgi.nim
parent10a02b2ae2613b383453ba99318330560e9371ac (diff)
downloadchawan-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 'src/loader/cgi.nim')
-rw-r--r--src/loader/cgi.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/loader/cgi.nim b/src/loader/cgi.nim
index 1da8fc4d..76076b1c 100644
--- a/src/loader/cgi.nim
+++ b/src/loader/cgi.nim
@@ -4,6 +4,7 @@ import std/posix
 import std/streams
 import std/strutils
 
+import config/chapath
 import extern/stdio
 import io/posixstream
 import loader/connecterror
@@ -38,6 +39,7 @@ proc setupEnv(cmd, scriptName, pathInfo, requestURI: string, request: Request,
   putEnv("SCRIPT_FILENAME", cmd)
   putEnv("REQUEST_URI", requestURI)
   putEnv("REQUEST_METHOD", $request.httpMethod)
+  putEnv("CHA_LIBEXEC_DIR", libexecPath)
   var headers = ""
   for k, v in request.headers:
     headers &= k & ": " & v & "\r\n"