diff --git a/README.md b/README.md index 9052e46..4d351a5 100644 --- a/README.md +++ b/README.md @@ -319,7 +319,8 @@ startup, database connection etc. on each request). single non-separator character and `*` matches a sequence of them - 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 - `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 prefixes and values are filesystem paths to unix domain sockets. Any request for a URL whose path begins with one of the specified diff --git a/config.go b/config.go index 8c42acc..74518ea 100644 --- a/config.go +++ b/config.go @@ -92,6 +92,13 @@ func getConfig(filename string) (Config, error) { 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 var cgiPaths []string for _, cgiPath := range config.CGIPaths {