about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-03-16 12:58:38 +0100
committerbptato <nincsnevem662@gmail.com>2024-03-16 13:00:05 +0100
commit4fa76ff48a06ab81c9ff9dcf4de745e1ebecfd1e (patch)
treee11dfa3797914bac84a2dc3e8ba6ba3b1cf05577
parent38c30549d3eda30a637af389694a0ecbc89973d5 (diff)
downloadchawan-4fa76ff48a06ab81c9ff9dcf4de745e1ebecfd1e.tar.gz
cgi: fix libexec dir not being set
-rw-r--r--src/loader/loader.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/loader/loader.nim b/src/loader/loader.nim
index d7b9a2a5..595847a8 100644
--- a/src/loader/loader.nim
+++ b/src/loader/loader.nim
@@ -24,6 +24,7 @@ import std/streams
 import std/strutils
 import std/tables
 
+import config/chapath
 import io/posixstream
 import io/promise
 import io/serialize
@@ -101,6 +102,7 @@ type
     ssock: ServerSocket
     alive: bool
     config: LoaderConfig
+    libexecPath: string
     handleMap: Table[int, LoaderHandle]
     outputMap: Table[int, OutputHandle]
     selector: Selector[int]
@@ -115,7 +117,6 @@ type
     cgiDir*: seq[string]
     uriMethodMap*: URIMethodMap
     w3mCGICompat*: bool
-    libexecPath*: string
     tmpdir*: string
 
   LoaderClientConfig* = object
@@ -393,8 +394,7 @@ proc loadResource(ctx: LoaderContext; client: ClientData; request: Request;
           redo = true
           continue
     if request.url.scheme == "cgi-bin":
-      handle.loadCGI(request, ctx.config.cgiDir, ctx.config.libexecPath,
-        prevurl)
+      handle.loadCGI(request, ctx.config.cgiDir, ctx.libexecPath, prevurl)
       if handle.istream != nil:
         ctx.addFd(handle)
       else:
@@ -632,6 +632,7 @@ proc initLoaderContext(fd: cint; config: LoaderConfig): LoaderContext =
     alive: true,
     config: config,
     selector: newSelector[int](),
+    libexecPath: ChaPath("${%CHA_LIBEXEC_DIR}").unquote().get
   )
   gctx = ctx
   #TODO ideally, buffered would be true. Unfortunately this conflicts with