forked from solderpunk/molly-brown
Consolidate some quick-failing path tests.
This commit is contained in:
parent
36378eb1c6
commit
9bce54882a
|
@ -67,7 +67,7 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
|||
|
||||
// Paranoid security measures:
|
||||
// Fail ASAP if the URL has mapped to a sensitive file
|
||||
if path == config.CertPath || path == config.KeyPath || path == config.AccessLog || path == config.ErrorLog {
|
||||
if path == config.CertPath || path == config.KeyPath || path == config.AccessLog || path == config.ErrorLog || filepath.Base(path) == ".molly" {
|
||||
conn.Write([]byte("51 Not found!\r\n"))
|
||||
log.Status = 51
|
||||
return
|
||||
|
@ -134,13 +134,6 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
|||
return
|
||||
}
|
||||
|
||||
// Don't serve Molly files
|
||||
if filepath.Base(path) == ".molly" {
|
||||
conn.Write([]byte("51 Not found!\r\n"))
|
||||
log.Status = 51
|
||||
return
|
||||
}
|
||||
|
||||
// Finally, serve the file or directory
|
||||
if info.IsDir() {
|
||||
serveDirectory(URL, path, &log, conn, config, errorLogEntries)
|
||||
|
|
Loading…
Reference in New Issue