diff --git a/config.go b/config.go index 9fb96b9..48b2aee 100644 --- a/config.go +++ b/config.go @@ -76,6 +76,9 @@ func getConfig(filename string) (Config, error) { return config, err } + // Force hostname to lowercase + config.Hostname = strings.ToLower(config.Hostname) + // Validate pseudo-enums switch config.DirectorySort { case "Name", "Size", "Time": diff --git a/handler.go b/handler.go index d476c3b..defea21 100644 --- a/handler.go +++ b/handler.go @@ -49,7 +49,7 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log } // Reject requests for content from other servers - if URL.Hostname() != config.Hostname || (URL.Port() != "" && URL.Port() != strconv.Itoa(config.Port)) { + if strings.ToLower(URL.Hostname()) != config.Hostname || (URL.Port() != "" && URL.Port() != strconv.Itoa(config.Port)) { conn.Write([]byte("53 No proxying to other hosts or ports!\r\n")) log.Status = 53 return