Merge branch 'master' of github.com:miekg/dns
This commit is contained in:
commit
10ad5a45e2
|
@ -168,10 +168,15 @@ func (mux *ServeMux) match(q string, t uint16) Handler {
|
||||||
mux.m.RLock()
|
mux.m.RLock()
|
||||||
defer mux.m.RUnlock()
|
defer mux.m.RUnlock()
|
||||||
var handler Handler
|
var handler Handler
|
||||||
|
b := make([]byte, len(q)) // worst case, one label of length q
|
||||||
off := 0
|
off := 0
|
||||||
end := false
|
end := false
|
||||||
for {
|
for {
|
||||||
if h, ok := mux.z[q[off:]]; ok {
|
l := len(q[off:])
|
||||||
|
for i := 0; i < l; i++ {
|
||||||
|
b[i] = q[off+i] | ( 'a' - 'A')
|
||||||
|
}
|
||||||
|
if h, ok := mux.z[string(b[:l])]; ok { // 'causes garbage, might want to change the map key
|
||||||
if t != TypeDS {
|
if t != TypeDS {
|
||||||
return h
|
return h
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -55,6 +55,14 @@ func TestServing(t *testing.T) {
|
||||||
t.Log("Unexpected result for example.com", txt, "!= Hello example")
|
t.Log("Unexpected result for example.com", txt, "!= Hello example")
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
|
// Test Mixes cased as notices by Ask.
|
||||||
|
m.SetQuestion("eXaMplE.cOm.", TypeTXT)
|
||||||
|
r, _, _ = c.Exchange(m, "127.0.0.1:8053")
|
||||||
|
txt = r.Extra[0].(*TXT).Txt[0]
|
||||||
|
if txt != "Hello example" {
|
||||||
|
t.Log("Unexpected result for example.com", txt, "!= Hello example")
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkServing(b *testing.B) {
|
func BenchmarkServing(b *testing.B) {
|
||||||
|
|
Loading…
Reference in New Issue