oracle: URI host validation is only relevant for https
NeoFS doesn't have hosts.
This commit is contained in:
parent
29b79db998
commit
bd9a303e29
1 changed files with 29 additions and 24 deletions
|
@ -97,12 +97,16 @@ func (o *Oracle) processRequest(priv *keys.PrivateKey, req request) error {
|
||||||
}
|
}
|
||||||
resp := &transaction.OracleResponse{ID: req.ID}
|
resp := &transaction.OracleResponse{ID: req.ID}
|
||||||
u, err := url.ParseRequestURI(req.Req.URL)
|
u, err := url.ParseRequestURI(req.Req.URL)
|
||||||
if err == nil && !o.MainCfg.AllowPrivateHost {
|
|
||||||
err = o.URIValidator(u)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.Code = transaction.Forbidden
|
resp.Code = transaction.Forbidden
|
||||||
} else if u.Scheme == "https" {
|
} else if u.Scheme == "https" {
|
||||||
|
if !o.MainCfg.AllowPrivateHost {
|
||||||
|
err = o.URIValidator(u)
|
||||||
|
if err != nil {
|
||||||
|
resp.Code = transaction.Forbidden
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err == nil {
|
||||||
r, err := o.Client.Get(req.Req.URL)
|
r, err := o.Client.Get(req.Req.URL)
|
||||||
switch {
|
switch {
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
@ -127,6 +131,7 @@ func (o *Oracle) processRequest(priv *keys.PrivateKey, req request) error {
|
||||||
default:
|
default:
|
||||||
resp.Code = transaction.Error
|
resp.Code = transaction.Error
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if err == nil && u.Scheme == neofs.URIScheme {
|
} else if err == nil && u.Scheme == neofs.URIScheme {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(o.MainCfg.NeoFS.Timeout)*time.Millisecond)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(o.MainCfg.NeoFS.Timeout)*time.Millisecond)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
Loading…
Reference in a new issue