summaryrefslogtreecommitdiff
path: root/vendor/github.com/miekg/dns/defaults.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-05-01 11:00:41 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-01 11:00:41 +0200
commit5904e3b4ee475076908d569afe816fd8a7e9d0d5 (patch)
treed2a60ddada251b2a800ee53439dba630684efb75 /vendor/github.com/miekg/dns/defaults.go
parent[bugfix] tweak httpclient error handling again ... (#1721) (diff)
downloadgotosocial-5904e3b4ee475076908d569afe816fd8a7e9d0d5.tar.xz
[chore]: Bump github.com/miekg/dns from 1.1.53 to 1.1.54 (#1727)
Bumps [github.com/miekg/dns](https://github.com/miekg/dns) from 1.1.53 to 1.1.54. - [Release notes](https://github.com/miekg/dns/releases) - [Changelog](https://github.com/miekg/dns/blob/master/Makefile.release) - [Commits](https://github.com/miekg/dns/compare/v1.1.53...v1.1.54) --- updated-dependencies: - dependency-name: github.com/miekg/dns dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/miekg/dns/defaults.go')
-rw-r--r--vendor/github.com/miekg/dns/defaults.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/vendor/github.com/miekg/dns/defaults.go b/vendor/github.com/miekg/dns/defaults.go
index 75b17f0c1..c1558b79c 100644
--- a/vendor/github.com/miekg/dns/defaults.go
+++ b/vendor/github.com/miekg/dns/defaults.go
@@ -272,18 +272,24 @@ func IsMsg(buf []byte) error {
// IsFqdn checks if a domain name is fully qualified.
func IsFqdn(s string) bool {
- s2 := strings.TrimSuffix(s, ".")
- if s == s2 {
+ // Check for (and remove) a trailing dot, returning if there isn't one.
+ if s == "" || s[len(s)-1] != '.' {
return false
}
+ s = s[:len(s)-1]
- i := strings.LastIndexFunc(s2, func(r rune) bool {
+ // If we don't have an escape sequence before the final dot, we know it's
+ // fully qualified and can return here.
+ if s == "" || s[len(s)-1] != '\\' {
+ return true
+ }
+
+ // Otherwise we have to check if the dot is escaped or not by checking if
+ // there are an odd or even number of escape sequences before the dot.
+ i := strings.LastIndexFunc(s, func(r rune) bool {
return r != '\\'
})
-
- // Test whether we have an even number of escape sequences before
- // the dot or none.
- return (len(s2)-i)%2 != 0
+ return (len(s)-i)%2 != 0
}
// IsRRset checks if a set of RRs is a valid RRset as defined by RFC 2181.