mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-30 12:05:38 +00:00
Do not respond to network error, silently fail to prevent caching of SERVFAIL
Hopefully we can improve the availability of DoH under unstable network environments.
This commit is contained in:
@@ -47,7 +47,7 @@ bootstrap = [
|
||||
]
|
||||
|
||||
# Timeout for upstream request
|
||||
timeout = 10
|
||||
timeout = 30
|
||||
|
||||
# Disable HTTP Cookies
|
||||
#
|
||||
|
||||
@@ -134,9 +134,8 @@ func (c *Client) generateRequestIETF(w dns.ResponseWriter, r *dns.Msg, isTCP boo
|
||||
if len(requestURL) < 2048 {
|
||||
req, err = http.NewRequest("GET", requestURL, nil)
|
||||
if err != nil {
|
||||
// Do not respond, silently fail to prevent caching of SERVFAIL
|
||||
log.Println(err)
|
||||
reply.Rcode = dns.RcodeServerFailure
|
||||
w.WriteMsg(reply)
|
||||
return &DNSRequest{
|
||||
err: err,
|
||||
}
|
||||
@@ -144,9 +143,8 @@ func (c *Client) generateRequestIETF(w dns.ResponseWriter, r *dns.Msg, isTCP boo
|
||||
} else {
|
||||
req, err = http.NewRequest("POST", upstream, bytes.NewReader(requestBinary))
|
||||
if err != nil {
|
||||
// Do not respond, silently fail to prevent caching of SERVFAIL
|
||||
log.Println(err)
|
||||
reply.Rcode = dns.RcodeServerFailure
|
||||
w.WriteMsg(reply)
|
||||
return &DNSRequest{
|
||||
err: err,
|
||||
}
|
||||
|
||||
@@ -23,5 +23,7 @@
|
||||
|
||||
package main
|
||||
|
||||
const VERSION = "1.3.3"
|
||||
const USER_AGENT = "DNS-over-HTTPS/" + VERSION + " (+https://github.com/m13253/dns-over-https)"
|
||||
const (
|
||||
VERSION = "1.3.3"
|
||||
USER_AGENT = "DNS-over-HTTPS/" + VERSION + " (+https://github.com/m13253/dns-over-https)"
|
||||
)
|
||||
|
||||
@@ -23,5 +23,7 @@
|
||||
|
||||
package main
|
||||
|
||||
const VERSION = "1.3.3"
|
||||
const USER_AGENT = "DNS-over-HTTPS/" + VERSION + " (+https://github.com/m13253/dns-over-https)"
|
||||
const (
|
||||
VERSION = "1.3.3"
|
||||
USER_AGENT = "DNS-over-HTTPS/" + VERSION + " (+https://github.com/m13253/dns-over-https)"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user