mirror of
https://github.com/m13253/dns-over-https.git
synced 2026-03-30 14:15:40 +00:00
Check HTTP status code
This commit is contained in:
@@ -183,6 +183,12 @@ func (c *Client) handlerFunc(w dns.ResponseWriter, r *dns.Msg, isTCP bool) {
|
||||
w.WriteMsg(reply)
|
||||
return
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
log.Printf("Server returned error: %s\n", resp.Status)
|
||||
reply.Rcode = dns.RcodeServerFailure
|
||||
w.WriteMsg(reply)
|
||||
return
|
||||
}
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user