More TXT related fixes

Add two corner cases for testing
This commit is contained in:
Miek Gieben 2012-02-13 19:08:37 +01:00
parent 6470b8335d
commit 37ef7bd219
2 changed files with 3 additions and 1 deletions

2
msg.go
View File

@ -650,7 +650,7 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
println("dns: failure unpacking txt strings")
return lenmsg, false
}
txt = append(txt, string(msg[off+1:off+l]))
txt = append(txt, string(msg[off+1:off+l+1]))
off += l+1
if off < rdlength {
// More

View File

@ -202,6 +202,8 @@ func TestQuotes(t *testing.T) {
`t.example.com. IN TXT "a bc"`: "t.example.com.\t3600\tIN\tTXT\t\"a bc\"",
`t.example.com. IN TXT "a
bc"`: "t.example.com.\t3600\tIN\tTXT\t\"a\n bc\"",
`t.example.com. IN TXT "a"`: "t.example.com.\t3600\tIN\tTXT\t\"a\"",
`t.example.com. IN TXT "aa"`: "t.example.com.\t3600\tIN\tTXT\t\"aa\"",
`t.example.com. IN TXT "aaa" ;`: "t.example.com.\t3600\tIN\tTXT\t\"aaa\"",
`t.example.com. IN TXT "abc" "DEF"`: "t.example.com.\t3600\tIN\tTXT\t\"abc\" \"DEF\"",
`t.example.com. IN TXT "abc" ( "DEF" )`: "t.example.com.\t3600\tIN\tTXT\t\"abc\" \"DEF\"",