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:
|
// Paranoid security measures:
|
||||||
// Fail ASAP if the URL has mapped to a sensitive file
|
// 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"))
|
conn.Write([]byte("51 Not found!\r\n"))
|
||||||
log.Status = 51
|
log.Status = 51
|
||||||
return
|
return
|
||||||
|
@ -134,13 +134,6 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
||||||
return
|
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
|
// Finally, serve the file or directory
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
serveDirectory(URL, path, &log, conn, config, errorLogEntries)
|
serveDirectory(URL, path, &log, conn, config, errorLogEntries)
|
||||||
|
|
Loading…
Reference in New Issue