mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-05-25 22:54:11 +00:00
Register a new HTTP client whenever an HTTP connection error happens
This commit is contained in:
@@ -93,12 +93,17 @@ func (c *Client) generateRequestGoogle(w dns.ResponseWriter, r *dns.Msg, isTCP b
|
||||
}
|
||||
req.Header.Set("Accept", "application/json, application/dns-udpwireformat")
|
||||
req.Header.Set("User-Agent", "DNS-over-HTTPS/1.1 (+https://github.com/m13253/dns-over-https)")
|
||||
c.httpClientMux.RLock()
|
||||
resp, err := c.httpClient.Do(req)
|
||||
c.httpClientMux.RUnlock()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
reply.Rcode = dns.RcodeServerFailure
|
||||
w.WriteMsg(reply)
|
||||
c.httpTransport.CloseIdleConnections()
|
||||
err1 := c.newHTTPClient()
|
||||
if err1 != nil {
|
||||
log.Fatalln(err1)
|
||||
}
|
||||
return &DNSRequest{
|
||||
err: err,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user