about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/loader/cgi.nim7
-rw-r--r--src/loader/loader.nim8
2 files changed, 8 insertions, 7 deletions
diff --git a/src/loader/cgi.nim b/src/loader/cgi.nim
index f72009d7..067e784d 100644
--- a/src/loader/cgi.nim
+++ b/src/loader/cgi.nim
@@ -27,13 +27,6 @@ proc putMappedURL(url: URL) =
 proc setupEnv(cmd, scriptName, pathInfo, requestURI, myDir: string;
     request: Request; contentLen: int; prevURL: URL) =
   let url = request.url
-  putEnv("SERVER_SOFTWARE", "Chawan")
-  putEnv("SERVER_PROTOCOL", "HTTP/1.0")
-  putEnv("SERVER_NAME", "localhost")
-  putEnv("SERVER_PORT", "80")
-  putEnv("REMOTE_HOST", "localhost")
-  putEnv("REMOTE_ADDR", "127.0.0.1")
-  putEnv("GATEWAY_INTERFACE", "CGI/1.1")
   putEnv("SCRIPT_NAME", scriptName)
   putEnv("SCRIPT_FILENAME", cmd)
   putEnv("REQUEST_URI", requestURI)
diff --git a/src/loader/loader.nim b/src/loader/loader.nim
index 17677eb5..6cc37b71 100644
--- a/src/loader/loader.nim
+++ b/src/loader/loader.nim
@@ -702,6 +702,14 @@ proc initLoaderContext(fd: cint; config: LoaderConfig): LoaderContext =
   stream.close()
   # unblock main socket
   ctx.ssock.sock.getFd().setBlocking(false)
+  # for CGI
+  putEnv("SERVER_SOFTWARE", "Chawan")
+  putEnv("SERVER_PROTOCOL", "HTTP/1.0")
+  putEnv("SERVER_NAME", "localhost")
+  putEnv("SERVER_PORT", "80")
+  putEnv("REMOTE_HOST", "localhost")
+  putEnv("REMOTE_ADDR", "127.0.0.1")
+  putEnv("GATEWAY_INTERFACE", "CGI/1.1")
   return ctx
 
 # This is only called when an OutputHandle could not read enough of one (or