Check that request port matches configured server port. Should fix #9.

This commit is contained in:
Solderpunk 2020-06-30 17:27:53 +02:00
parent b0fd07f58a
commit 4c27911e8f
1 changed files with 2 additions and 3 deletions

View File

@ -60,9 +60,8 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
}
// Reject requests for content from other servers
requestHostname := strings.Split(URL.Host, ":")[0] // Shave off port
if requestHostname != config.Hostname {
conn.Write([]byte("53 No proxying to other hosts!\r\n"))
if URL.Hostname() != config.Hostname || (URL.Port() != "" && URL.Port() != config.Port) {
conn.Write([]byte("53 No proxying to other hosts or ports!\r\n"))
log.Status = 53
return
}