From f9c76936771719777fde4b20b2c9cfe5205c5bcb Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 3 May 2022 23:18:53 +0300 Subject: [PATCH] oracle: limit the number of redirections to 2 Be compatible with neo-project/neo-modules#698. --- pkg/services/oracle/network.go | 2 +- pkg/services/oracle/oracle.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/services/oracle/network.go b/pkg/services/oracle/network.go index 3f07393e1..d4b096215 100644 --- a/pkg/services/oracle/network.go +++ b/pkg/services/oracle/network.go @@ -87,7 +87,7 @@ func getDefaultClient(cfg config.OracleConfiguration) *http.Client { } client.Timeout = cfg.RequestTimeout client.CheckRedirect = func(req *http.Request, via []*http.Request) error { - if len(via) >= maxRedirections { // from https://github.com/neo-project/neo-modules/pull/694 + if len(via) > maxRedirections { // from https://github.com/neo-project/neo-modules/pull/698 return fmt.Errorf("%w: %d redirections are reached", ErrRestrictedRedirect, maxRedirections) } return nil diff --git a/pkg/services/oracle/oracle.go b/pkg/services/oracle/oracle.go index a67a6f1e2..bd3a04e7c 100644 --- a/pkg/services/oracle/oracle.go +++ b/pkg/services/oracle/oracle.go @@ -110,7 +110,7 @@ const ( defaultRefreshInterval = time.Minute * 3 // maxRedirections is the number of allowed redirections for Oracle HTTPS request. - maxRedirections = 5 + maxRedirections = 2 ) // ErrRestrictedRedirect is returned when redirection to forbidden address occurs