Upgrade the definition of domain name

This commit is contained in:
Miek Gieben 2012-02-28 20:47:25 +01:00
parent e816e64e3e
commit 99a7a57713
3 changed files with 3 additions and 3 deletions

View File

@ -243,8 +243,8 @@ func IsDomainName(s string) (uint8, uint8, bool) { // copied from net package.
}
partlen++
case c == '.':
// byte before dot cannot be dot, dash
if last == '.' || last == '-' {
// byte before dot cannot be dot
if last == '.' {
return 0, uint8(l - longer), false
}
if last == '\\' { // Ok, escaped dot.

View File

@ -111,6 +111,7 @@ func TestPack(t *testing.T) {
m.Answer[0], err = NewRR(r)
if err != nil {
t.Logf("Failed to create RR: %s\n", err.Error())
t.Fail()
continue
}
if _, ok := m.Pack(); !ok {

1
msg.go
View File

@ -1284,7 +1284,6 @@ func (dns *Msg) Len() int {
for i := 0; i < len(dns.Question); i++ {
l += dns.Question[i].Len()
}
println("LENGTE", len(dns.Answer))
for i := 0; i < len(dns.Answer); i++ {
l += dns.Answer[i].Len()
}