Make test of request URL hostname against configured hostname case insensitive. Closes #29.
This commit is contained in:
parent
16ed9e5cff
commit
f05bab2b73
|
@ -76,6 +76,9 @@ func getConfig(filename string) (Config, error) {
|
||||||
return config, err
|
return config, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force hostname to lowercase
|
||||||
|
config.Hostname = strings.ToLower(config.Hostname)
|
||||||
|
|
||||||
// Validate pseudo-enums
|
// Validate pseudo-enums
|
||||||
switch config.DirectorySort {
|
switch config.DirectorySort {
|
||||||
case "Name", "Size", "Time":
|
case "Name", "Size", "Time":
|
||||||
|
|
|
@ -49,7 +49,7 @@ func handleGeminiRequest(conn net.Conn, config Config, accessLogEntries chan Log
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reject requests for content from other servers
|
// 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"))
|
conn.Write([]byte("53 No proxying to other hosts or ports!\r\n"))
|
||||||
log.Status = 53
|
log.Status = 53
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue