From 6f7d5cc4be1d2ed16bbd387d19bec78de67a95a0 Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Tue, 16 Apr 2024 17:23:46 +0300 Subject: [PATCH] Pull request 2202: Fix access error Squashed commit of the following: commit 55074010c38c0824c1df4a7c682a3baef4755015 Author: Eugene Burkov Date: Tue Apr 16 17:16:41 2024 +0300 all: rm replace commit 983f8d133199225f495e25efa4afae3ef6d2eee4 Merge: d9fc69d69 201ac73cf Author: Eugene Burkov Date: Tue Apr 16 16:06:28 2024 +0300 Merge branch 'master' into fix-access-error commit d9fc69d69a315de83ef50a64bf9f5b4b2e50c8d3 Author: Eugene Burkov Date: Thu Apr 11 19:18:24 2024 +0300 all: fix before request, upd golibs --- go.mod | 2 +- go.sum | 4 ++-- internal/dnsforward/beforerequest.go | 5 ++++- internal/dnsforward/http.go | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 5c8bbd38227..f81a3f38cb5 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/AdguardTeam/AdGuardHome go 1.22.2 require ( - github.com/AdguardTeam/dnsproxy v0.69.1 + github.com/AdguardTeam/dnsproxy v0.69.2 github.com/AdguardTeam/golibs v0.23.2 github.com/AdguardTeam/urlfilter v0.18.0 github.com/NYTimes/gziphandler v1.1.1 diff --git a/go.sum b/go.sum index 0153ce9bee7..0dc25336a95 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/AdguardTeam/dnsproxy v0.69.1 h1:KiLkKUSrvHeUO/YEf4Bbo/5zyFRIvQstjL7W9G/24pk= -github.com/AdguardTeam/dnsproxy v0.69.1/go.mod h1:atO3WeeuyepyhjSt6hC+MF7/IN7TZHfG3/ZwhImHzYs= +github.com/AdguardTeam/dnsproxy v0.69.2 h1:/qnjEILMIM7koAIcy+ZB19lb+PSZjJWKjxuGyqVVpp0= +github.com/AdguardTeam/dnsproxy v0.69.2/go.mod h1:zpA9eBxakSyjKC/bUac+UPSYTp/Q43aOmNlBV2/D6ug= github.com/AdguardTeam/golibs v0.23.2 h1:rMjYantwtQ39e8G4zBQ6ZLlm4s3XH30Bc9VxhoOHwao= github.com/AdguardTeam/golibs v0.23.2/go.mod h1:o9i55Sx6v7qogRQeqaBfmLbC/pZqeMBWi015U5PTDY0= github.com/AdguardTeam/urlfilter v0.18.0 h1:ZZzwODC/ADpjJSODxySrrUnt/fvOCfGFaCW6j+wsGfQ= diff --git a/internal/dnsforward/beforerequest.go b/internal/dnsforward/beforerequest.go index 75c64cecfc7..21bc43a3985 100644 --- a/internal/dnsforward/beforerequest.go +++ b/internal/dnsforward/beforerequest.go @@ -25,7 +25,10 @@ func (s *Server) HandleBefore( ) (err error) { clientID, err := s.clientIDFromDNSContext(pctx) if err != nil { - return fmt.Errorf("getting clientid: %w", err) + return &proxy.BeforeRequestError{ + Err: fmt.Errorf("getting clientid: %w", err), + Response: s.NewMsgSERVFAIL(pctx.Req), + } } blocked, _ := s.IsBlockedClient(pctx.Addr.Addr(), clientID) diff --git a/internal/dnsforward/http.go b/internal/dnsforward/http.go index 01fe6720837..76f88edc1e3 100644 --- a/internal/dnsforward/http.go +++ b/internal/dnsforward/http.go @@ -461,7 +461,7 @@ func (s *Server) handleSetConfig(w http.ResponseWriter, r *http.Request) { // TODO(e.burkov): Consider prebuilding this set on startup. ourAddrs, err := s.conf.ourAddrsSet() if err != nil { - // TODO(e.burkov): Put into openapi + // TODO(e.burkov): Put into openapi. aghhttp.Error(r, w, http.StatusInternalServerError, "getting our addresses: %s", err) return