This commit is contained in:
Star Brilliant
2017-10-04 00:49:45 +08:00
parent 252a335b89
commit 5e1b33bab5
2 changed files with 11 additions and 1 deletions

View File

@@ -123,7 +123,15 @@ func (c *Client) handlerFunc(w dns.ResponseWriter, r *dns.Msg, isTCP bool) {
requestURL += fmt.Sprintf("&edns_client_subnet=%s/%d", ednsClientAddress.String(), ednsClientNetmask)
}
resp, err := http.Get(requestURL)
req, err := http.NewRequest("GET", requestURL, nil)
if err != nil {
log.Println(err)
reply.Rcode = dns.RcodeServerFailure
w.WriteMsg(reply)
return
}
req.Header.Set("User-Agent", "DNS-over-HTTPS/1.0 (+https://github.com/m13253/dns-over-https)")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Println(err)
reply.Rcode = dns.RcodeServerFailure

View File

@@ -79,6 +79,8 @@ func (s *Server) Start() error {
func (s *Server) handlerFunc(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
w.Header().Set("Server", "DNS-over-HTTPS/1.0 (+https://github.com/m13253/dns-over-https)")
w.Header().Set("X-Powered-By", "DNS-over-HTTPS/1.0 (+https://github.com/m13253/dns-over-https)")
name := r.FormValue("name")
if name == "" {