Accept requests where the URL has a FQDN hostname with a trailing dot. Closes #20.
This commit is contained in:
parent
a41898b012
commit
733e518392
1 changed files with 6 additions and 1 deletions
|
@ -49,7 +49,12 @@ 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 strings.ToLower(URL.Hostname()) != config.Hostname || (URL.Port() != "" && URL.Port() != strconv.Itoa(config.Port)) {
|
requestedHost := strings.ToLower(URL.Hostname())
|
||||||
|
// Trim trailing . from FQDNs
|
||||||
|
if strings.HasSuffix(requestedHost, ".") {
|
||||||
|
requestedHost = requestedHost[:len(requestedHost)-1]
|
||||||
|
}
|
||||||
|
if requestedHost != 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 a new issue