about summary refs log tree commit diff stats
path: root/src/loader
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-07 00:39:04 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-07 00:39:28 +0100
commit337828e5d46f1fe10fea2281422b19c54eb0b9bd (patch)
treeca318e56327a8ca4e925cfe4b693b389eadec97d /src/loader
parent01b42054795768837b6114dafdf27fc4faf8c53a (diff)
downloadchawan-337828e5d46f1fe10fea2281422b19c54eb0b9bd.tar.gz
cgi: pass system error message after execl failure
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/cgi.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/loader/cgi.nim b/src/loader/cgi.nim
index cb6e8ae4..848df1b7 100644
--- a/src/loader/cgi.nim
+++ b/src/loader/cgi.nim
@@ -211,7 +211,8 @@ proc loadCGI*(handle: LoaderHandle, request: Request, cgiDir: seq[string],
       contentLen, prevURL)
     discard execl(cstring(cmd), cstring(basename), nil)
     let code = int(ERROR_FAILED_TO_EXECUTE_CGI_SCRIPT)
-    stdout.write("Cha-Control: ConnectionError " & $code)
+    stdout.write("Cha-Control: ConnectionError " & $code &
+      ($strerror(errno)).deleteChars({'\n', '\r'}))
     quit(1)
   else:
     discard close(pipefd[1]) # close write