Commit 27e22b06 authored by Miek Gieben's avatar Miek Gieben Committed by corbot[bot]

Use strings.ToLower in server (#3304)

Automatically submitted.
parent eb59e792
......@@ -6,6 +6,7 @@ import (
"fmt"
"net"
"runtime"
"strings"
"sync"
"time"
......@@ -217,27 +218,18 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return
}
q := r.Question[0].Name
b := make([]byte, len(q))
var off int
var end bool
var dshandler *Config
// Wrap the response writer in a ScrubWriter so we automatically make the reply fit in the client's buffer.
w = request.NewScrubWriter(r, w)
for {
l := len(q[off:])
for i := 0; i < l; i++ {
b[i] = q[off+i]
// normalize the name for the lookup
if b[i] >= 'A' && b[i] <= 'Z' {
b[i] |= ('a' - 'A')
}
}
q := strings.ToLower(r.Question[0].Name)
var (
off int
end bool
dshandler *Config
)
if h, ok := s.zones[string(b[:l])]; ok {
for {
if h, ok := s.zones[q[off:]]; ok {
if r.Question[0].Qtype != dns.TypeDS {
if h.FilterFunc == nil {
rcode, _ := h.pluginChain.ServeDNS(ctx, w, r)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment