From f621d88d998598f84ad049a8ac67207cb87e1bb0 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Thu, 16 Nov 2017 15:47:42 +0800 Subject: [PATCH] Turn requests lower case (to get rid of knot-resolver's mixed case) --- doh-client/client.go | 3 ++- doh-server/server.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doh-client/client.go b/doh-client/client.go index 5f95a2c..09e3c3e 100644 --- a/doh-client/client.go +++ b/doh-client/client.go @@ -28,6 +28,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "time" "github.com/miekg/dns" "../json-dns" @@ -129,7 +130,7 @@ func (c *Client) handlerFunc(w dns.ResponseWriter, r *dns.Msg, isTCP bool) { return } question := r.Question[0] - questionName := question.Name + questionName := strings.ToLower(question.Name) questionType := "" if qtype, ok := dns.TypeToString[question.Qtype]; ok { questionType = qtype diff --git a/doh-server/server.go b/doh-server/server.go index 74547b4..2257902 100644 --- a/doh-server/server.go +++ b/doh-server/server.go @@ -87,6 +87,7 @@ func (s *Server) handlerFunc(w http.ResponseWriter, r *http.Request) { jsonDNS.FormatError(w, "Invalid argument value: \"name\"", 400) return } + name = strings.ToLower(name) if punycode, err := idna.ToASCII(name); err == nil { name = punycode } else {