Skip to content

Commit

Permalink
Do not respond to network error, silently fail to prevent caching of …
Browse files Browse the repository at this point in the history
…SERVFAIL

Hopefully we can improve the availability of DoH under unstable network environments.
  • Loading branch information
m13253 committed Apr 26, 2018
1 parent 1b90731 commit c4b2236
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion doh-client/doh-client.conf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bootstrap = [
]

# Timeout for upstream request
timeout = 10
timeout = 30

# Disable HTTP Cookies
#
Expand Down
6 changes: 2 additions & 4 deletions doh-client/ietf.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,17 @@ 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,
}
}
} 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,
}
Expand Down
6 changes: 4 additions & 2 deletions doh-client/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
)
6 changes: 4 additions & 2 deletions doh-server/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
)

0 comments on commit c4b2236

Please sign in to comment.