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 ( ...@@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"net" "net"
"runtime" "runtime"
"strings"
"sync" "sync"
"time" "time"
...@@ -217,27 +218,18 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) ...@@ -217,27 +218,18 @@ func (s *Server) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
return 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. // Wrap the response writer in a ScrubWriter so we automatically make the reply fit in the client's buffer.
w = request.NewScrubWriter(r, w) w = request.NewScrubWriter(r, w)
for { q := strings.ToLower(r.Question[0].Name)
l := len(q[off:]) var (
for i := 0; i < l; i++ { off int
b[i] = q[off+i] end bool
// normalize the name for the lookup dshandler *Config
if b[i] >= 'A' && b[i] <= 'Z' { )
b[i] |= ('a' - 'A')
}
}
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 r.Question[0].Qtype != dns.TypeDS {
if h.FilterFunc == nil { if h.FilterFunc == nil {
rcode, _ := h.pluginChain.ServeDNS(ctx, w, r) 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