Merge pull request #2456 from nspcc-dev/oracle-2-redirections
oracle: limit the number of redirections to 2
This commit is contained in:
commit
bde0a4367f
2 changed files with 2 additions and 2 deletions
|
@ -87,7 +87,7 @@ func getDefaultClient(cfg config.OracleConfiguration) *http.Client {
|
||||||
}
|
}
|
||||||
client.Timeout = cfg.RequestTimeout
|
client.Timeout = cfg.RequestTimeout
|
||||||
client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
|
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 fmt.Errorf("%w: %d redirections are reached", ErrRestrictedRedirect, maxRedirections)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -110,7 +110,7 @@ const (
|
||||||
defaultRefreshInterval = time.Minute * 3
|
defaultRefreshInterval = time.Minute * 3
|
||||||
|
|
||||||
// maxRedirections is the number of allowed redirections for Oracle HTTPS request.
|
// maxRedirections is the number of allowed redirections for Oracle HTTPS request.
|
||||||
maxRedirections = 5
|
maxRedirections = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
// ErrRestrictedRedirect is returned when redirection to forbidden address occurs
|
// ErrRestrictedRedirect is returned when redirection to forbidden address occurs
|
||||||
|
|
Loading…
Reference in a new issue