mirror of
https://tildegit.org/solderpunk/molly-brown.git
synced 2025-04-13 09:29:46 +00:00
Make test of request URL hostname against configured hostname case insensitive. Closes #29.
This commit is contained in:
parent
16ed9e5cff
commit
f05bab2b73
2 changed files with 4 additions and 1 deletions
|
@ -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":
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue