Merge pull request #2456 from nspcc-dev/oracle-2-redirections

oracle: limit the number of redirections to 2
This commit is contained in:
Roman Khimov 2022-05-04 10:10:56 +03:00 committed by GitHub
commit bde0a4367f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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