Skip to content

Commit

Permalink
revert(allowed_host_validator.go): revert function IsUrlHostValid
Browse files Browse the repository at this point in the history
revert function IsUrlHostValid
  • Loading branch information
XdpCs committed Jan 19, 2024
1 parent bd6b781 commit 0e3d91f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions authentication/allowed_hosts_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ func (v *AllowedHostsValidator) SetAllowedHostsErrorCheck(hosts []string) error

// IsValidHost returns true if the host is valid.
func (v *AllowedHostsValidator) IsUrlHostValid(uri *u.URL) bool {
if uri == nil || uri.Hostname() == "" {
if uri == nil {
return false
}
return len(v.validHosts) == 0 || v.validHosts[strings.ToLower(uri.Hostname())]
host := uri.Hostname()
if host == "" {
return false
}
return len(v.validHosts) == 0 || v.validHosts[strings.ToLower(host)]
}

0 comments on commit 0e3d91f

Please sign in to comment.