diff --git a/handler.go b/handler.go index ab10646..2fad0ef 100644 --- a/handler.go +++ b/handler.go @@ -90,6 +90,15 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log 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 var cgiPaths []string 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 info, err := os.Stat(path) if os.IsNotExist(err) || os.IsPermission(err) {