Add extra length test for issue #105
This commit is contained in:
parent
f0bd4137e2
commit
9f5fcf8459
16
dns_test.go
16
dns_test.go
|
@ -316,6 +316,22 @@ func TestMsgLength2(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testMsgLengthCompressionMalformed(t *testing.T) {
|
||||||
|
// SOA with empty hostmaster, which is illegal
|
||||||
|
soa := &SOA{Hdr: RR_Header{Name: ".", Rrtype: TypeSOA, Class: ClassINET, Ttl: 12345},
|
||||||
|
Ns: ".",
|
||||||
|
Mbox: "",
|
||||||
|
Serial: 0,
|
||||||
|
Refresh: 28800,
|
||||||
|
Retry: 7200,
|
||||||
|
Expire: 604800,
|
||||||
|
Minttl: 60}
|
||||||
|
m := new(Msg)
|
||||||
|
m.Compress = true
|
||||||
|
m.Ns = []RR{soa}
|
||||||
|
m.Len()
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkMsgLength(b *testing.B) {
|
func BenchmarkMsgLength(b *testing.B) {
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
makeMsg := func(question string, ans, ns, e []RR) *Msg {
|
makeMsg := func(question string, ans, ns, e []RR) *Msg {
|
||||||
|
|
Loading…
Reference in New Issue