mirror of
https://tildegit.org/solderpunk/molly-brown.git
synced 2025-04-13 09:29:46 +00:00
Handle all requests which don't involve the filesystem before all which do.
This commit is contained in:
parent
9bce54882a
commit
35bf4d16c3
1 changed files with 9 additions and 9 deletions
18
handler.go
18
handler.go
|
@ -90,6 +90,15 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check whether this URL is mapped to an SCGI app
|
||||||
|
for scgi_url, scgi_socket := range config.SCGIPaths {
|
||||||
|
matched, err := regexp.Match(scgi_url, []byte(URL.Path))
|
||||||
|
if matched && err == nil {
|
||||||
|
handleSCGI(scgi_socket, config, URL, &log, conn)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check whether this URL is in a configured CGI path
|
// Check whether this URL is in a configured CGI path
|
||||||
var cgiPaths []string
|
var cgiPaths []string
|
||||||
for _, cgiPath := range config.CGIPaths {
|
for _, cgiPath := range config.CGIPaths {
|
||||||
|
@ -109,15 +118,6 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether this URL is mapped to an SCGI app
|
|
||||||
for scgi_url, scgi_socket := range config.SCGIPaths {
|
|
||||||
matched, err := regexp.Match(scgi_url, []byte(URL.Path))
|
|
||||||
if matched && err == nil {
|
|
||||||
handleSCGI(scgi_socket, config, URL, &log, conn)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fail if file does not exist or perms aren't right
|
// Fail if file does not exist or perms aren't right
|
||||||
info, err := os.Stat(path)
|
info, err := os.Stat(path)
|
||||||
if os.IsNotExist(err) || os.IsPermission(err) {
|
if os.IsNotExist(err) || os.IsPermission(err) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue