mirror of
https://github.com/soypat/lneto.git
synced 2026-09-12 09:39:31 +00:00
dns: simplify @hnw function and additional fixes
This commit is contained in:
@@ -253,20 +253,7 @@ func trimOWS(b []byte) []byte {
|
||||
return b
|
||||
}
|
||||
|
||||
// equalFold compares b to the ASCII lowercase key, case insensitively.
|
||||
// equalFold compares b to key, case insensitively.
|
||||
func equalFold(b []byte, key string) bool {
|
||||
if len(b) != len(key) {
|
||||
return false
|
||||
}
|
||||
const asciiCapDiff = 'a' - 'A'
|
||||
for i := range b {
|
||||
c := b[i]
|
||||
if c >= 'A' && c <= 'Z' {
|
||||
c += asciiCapDiff
|
||||
}
|
||||
if c != key[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
return EqualFoldASCII(b2s(b), key)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user