From 1be17bff4dff854ee5efcef6e580dddc52983344 Mon Sep 17 00:00:00 2001 From: Star Brilliant Date: Fri, 23 Mar 2018 15:28:42 +0800 Subject: [PATCH] Fix a problem when a single HTTP error crashes the program --- doh-client/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doh-client/client.go b/doh-client/client.go index 1624247..dc4fb42 100644 --- a/doh-client/client.go +++ b/doh-client/client.go @@ -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" {