about summary refs log tree commit diff stats
path: root/src/loader/cgi.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-12-21 18:19:44 +0100
committerbptato <nincsnevem662@gmail.com>2023-12-21 18:19:44 +0100
commitaad2c9860410cdbe0a80b48aba74437994cfd3e1 (patch)
tree3147d451b902e5e68e37914c34391a46db3933e8 /src/loader/cgi.nim
parent98fd959625c2f9227066fdd43590af12c8f40e91 (diff)
downloadchawan-aad2c9860410cdbe0a80b48aba74437994cfd3e1.tar.gz
cgi: return ConnectionError when script is not executable
Diffstat (limited to 'src/loader/cgi.nim')
-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 dfe66e22..467e2087 100644
--- a/src/loader/cgi.nim
+++ b/src/loader/cgi.nim
@@ -211,7 +211,8 @@ proc loadCGI*(handle: LoaderHandle, request: Request, cgiDir: seq[string],
     setupEnv(cmd, scriptName, pathInfo, requestURI, request, contentLen,
       prevURL)
     discard execl(cstring(cmd), cstring(basename), nil)
-    stdout.write("Content-Type: text/plain\r\n\r\nFailed to execute script.")
+    let code = int(ERROR_FAILED_TO_EXECUTE_CGI_SCRIPT)
+    stdout.write("Cha-Control: ConnectionError " & $code)
     quit(1)
   else:
     discard close(pipefd[1]) # close write