1
1
Fork 0
mirror of https://tildegit.org/solderpunk/molly-brown synced 2024-05-24 11:46:03 +02:00

Resolve non-absolute values of CGIPaths relative to DocBase. Closes #24.

This commit is contained in:
Solderpunk 2023-02-05 16:54:00 +01:00
parent 2d6f4db38e
commit 8541b6194b
2 changed files with 9 additions and 1 deletions

View File

@ -319,7 +319,8 @@ startup, database connection etc. on each request).
single non-separator character and `*` matches a sequence of them - single non-separator character and `*` matches a sequence of them -
if wildcards are used, the path should *not* end in a trailing slash if wildcards are used, the path should *not* end in a trailing slash
- this appears to be a peculiarity of the Go standard library's - this appears to be a peculiarity of the Go standard library's
`filepath.Glob` function. `filepath.Glob` function. Any non-absolute paths will be resolved
relative to `DocBase`.
* `SCGIPaths`: In this section of the config file, keys are URL path * `SCGIPaths`: In this section of the config file, keys are URL path
prefixes and values are filesystem paths to unix domain sockets. prefixes and values are filesystem paths to unix domain sockets.
Any request for a URL whose path begins with one of the specified Any request for a URL whose path begins with one of the specified

View File

@ -92,6 +92,13 @@ func getConfig(filename string) (Config, error) {
return config, errors.New("Invalid DirectorySort value.") return config, errors.New("Invalid DirectorySort value.")
} }
// Absolutise CGI paths
for index, cgiPath := range config.CGIPaths {
if(!filepath.IsAbs(cgiPath)) {
config.CGIPaths[index] = filepath.Join(config.DocBase, cgiPath)
}
}
// Expand CGI paths // Expand CGI paths
var cgiPaths []string var cgiPaths []string
for _, cgiPath := range config.CGIPaths { for _, cgiPath := range config.CGIPaths {