Fix a problem when a single HTTP error crashes the program

This commit is contained in:
Star Brilliant
2018-03-23 15:28:42 +08:00
parent ab2bf57995
commit 1be17bff4d

View File

@@ -178,6 +178,10 @@ func (c *Client) handlerFunc(w dns.ResponseWriter, r *dns.Msg, isTCP bool) {
panic("Unknown request Content-Type")
}
if req.err != nil {
return
}
contentType := ""
candidateType := strings.SplitN(req.response.Header.Get("Content-Type"), ";", 2)[0]
if candidateType == "application/json" {