From 1b3122dd35c23a4cc4dbd86be842f3b97d93ff48 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 12 Nov 2019 18:26:45 +0300 Subject: [PATCH] * /control/set_upstreams_config: allow empty upstream list --- dnsforward/dnsforward_http.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dnsforward/dnsforward_http.go b/dnsforward/dnsforward_http.go index a2660b81..25a2aae3 100644 --- a/dnsforward/dnsforward_http.go +++ b/dnsforward/dnsforward_http.go @@ -146,10 +146,12 @@ func (s *Server) handleSetUpstreamConfig(w http.ResponseWriter, r *http.Request) return } - err = ValidateUpstreams(req.Upstreams) - if err != nil { - httpError(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) - return + if len(req.Upstreams) != 0 { + err = ValidateUpstreams(req.Upstreams) + if err != nil { + httpError(r, w, http.StatusBadRequest, "wrong upstreams specification: %s", err) + return + } } newconf := FilteringConfig{}