Remove port number from hostname before comparing against configured hostname.

This commit is contained in:
Solderpunk 2019-11-24 12:29:38 +02:00
parent c13acf9c4b
commit 10a169a7f3
1 changed files with 2 additions and 1 deletions

View File

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