Former-commit-id: a166bf3be97f6cc8a2ab4a8890881c258c4729d6
This commit is contained in:
Gerasimos (Makis) Maropoulos 2020-05-30 20:25:37 +03:00
parent 1079bb8f8b
commit c32dd0d95c

View File

@ -1947,11 +1947,16 @@ func (ctx *context) GetDomain() string {
host = host[0:portIdx]
}
if domain, err := publicsuffix.EffectiveTLDPlusOne(host); err == nil {
host = domain
}
switch host {
case "127.0.0.1", "0.0.0.0", "::1", "[::1]", "0:0:0:0:0:0:0", "0:0:0:0:0:0:1":
return "localhost"
default:
if domain, err := publicsuffix.EffectiveTLDPlusOne(host); err == nil {
host = domain
}
return host
return host
}
}
// IsAjax returns true if this request is an 'ajax request'( XMLHttpRequest)