diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config/config.nim | 1 | ||||
-rw-r--r-- | src/loader/cgi.nim | 9 | ||||
-rw-r--r-- | src/loader/loader.nim | 5 | ||||
-rw-r--r-- | src/local/pager.nim | 6 |
4 files changed, 16 insertions, 5 deletions
diff --git a/src/config/config.nim b/src/config/config.nim index 81630f07..56c448d7 100644 --- a/src/config/config.nim +++ b/src/config/config.nim @@ -55,6 +55,7 @@ type stylesheet*: Option[string] proxy*: Option[URL] default_headers*: TableRef[string, string] + insecure_ssl_no_verify*: Option[bool] OmniRule* = object match*: Regex diff --git a/src/loader/cgi.nim b/src/loader/cgi.nim index 79344b6f..2c395e95 100644 --- a/src/loader/cgi.nim +++ b/src/loader/cgi.nim @@ -24,7 +24,8 @@ proc putMappedURL(url: URL) = putEnv("MAPPED_URI_QUERY", url.query.get("")) proc setupEnv(cmd, scriptName, pathInfo, requestURI, myDir: string; - request: Request; contentLen: int; prevURL: URL) = + request: Request; contentLen: int; prevURL: URL; + insecureSSLNoVerify: bool) = let url = request.url putEnv("SCRIPT_NAME", scriptName) putEnv("SCRIPT_FILENAME", cmd) @@ -52,6 +53,8 @@ proc setupEnv(cmd, scriptName, pathInfo, requestURI, myDir: string; putEnv("HTTP_REFERER", $request.referrer) if request.proxy != nil: putEnv("ALL_PROXY", $request.proxy) + if insecureSSLNoVerify: + putEnv("CHA_INSECURE_SSL_NO_VERIFY", "1") setCurrentDir(myDir) type ControlResult = enum @@ -123,7 +126,7 @@ proc handleLine(handle: LoaderHandle; line: string; headers: Headers) = headers.add(k, v) proc loadCGI*(handle: LoaderHandle; request: Request; cgiDir: seq[string]; - prevURL: URL) = + prevURL: URL; insecureSSLNoVerify: bool) = if cgiDir.len == 0: handle.sendResult(ERROR_NO_CGI_DIR) return @@ -205,7 +208,7 @@ proc loadCGI*(handle: LoaderHandle; request: Request; cgiDir: seq[string]; closeStdin() # we leave stderr open, so it can be seen in the browser console setupEnv(cmd, scriptName, pathInfo, requestURI, myDir, request, contentLen, - prevURL) + prevURL, insecureSSLNoVerify) # reset SIGCHLD to the default handler. this is useful if the child process # expects SIGCHLD to be untouched. (e.g. git dies a horrible death with # SIGCHLD as SIG_IGN) diff --git a/src/loader/loader.nim b/src/loader/loader.nim index 21511c56..7abf7761 100644 --- a/src/loader/loader.nim +++ b/src/loader/loader.nim @@ -133,6 +133,7 @@ type # loader proxy (i.e. the variable above). acceptProxy*: bool referrerPolicy*: ReferrerPolicy + insecureSSLNoVerify*: bool FetchPromise* = Promise[JSResult[Response]] @@ -403,7 +404,8 @@ proc loadResource(ctx: LoaderContext; client: ClientData; request: Request; redo = true continue if request.url.scheme == "cgi-bin": - handle.loadCGI(request, ctx.config.cgiDir, prevurl) + handle.loadCGI(request, ctx.config.cgiDir, prevurl, + client.config.insecureSSLNoVerify) if handle.istream != nil: ctx.addFd(handle) else: @@ -739,6 +741,7 @@ proc initLoaderContext(fd: cint; config: LoaderConfig): LoaderContext = putEnv("REMOTE_HOST", "localhost") putEnv("REMOTE_ADDR", "127.0.0.1") putEnv("GATEWAY_INTERFACE", "CGI/1.1") + putEnv("CHA_INSECURE_SSL_NO_VERIFY", "0") return ctx # This is only called when an OutputHandle could not read enough of one (or diff --git a/src/local/pager.nim b/src/local/pager.nim index 05ebe376..0a2b8e6b 100644 --- a/src/local/pager.nim +++ b/src/local/pager.nim @@ -873,6 +873,7 @@ proc applySiteconf(pager: Pager; url: var URL; charsetOverride: Charset; var userstyle = pager.config.css.stylesheet var proxy = pager.config.network.proxy let ctx = pager.jsctx + var insecureSSLNoVerify = false for sc in pager.config.siteconf: if sc.url.isSome and not sc.url.get.match($url): continue @@ -916,6 +917,8 @@ proc applySiteconf(pager: Pager; url: var URL; charsetOverride: Charset; proxy = sc.proxy.get if sc.default_headers != nil: headers = newHeaders(sc.default_headers[]) + if sc.insecure_ssl_no_verify.isSome: + insecureSSLNoVerify = sc.insecure_ssl_no_verify.get loaderConfig = LoaderClientConfig( defaultHeaders: headers, cookiejar: cookieJar, @@ -924,7 +927,8 @@ proc applySiteconf(pager: Pager; url: var URL; charsetOverride: Charset; scheme = some(url.scheme), allowschemes = @["data", "cache"], default = true - ) + ), + insecureSSLNoVerify: insecureSSLNoVerify ) return BufferConfig( userstyle: userstyle, |