oracle: limit the number of redirections to 2

Be compatible with neo-project/neo-modules#698.
This commit is contained in:
Roman Khimov 2022-05-03 23:18:53 +03:00
parent 19eb976166
commit f9c7693677
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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