-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add oracle global timeout #698
Conversation
Use CancellationTokenSource ctsTimeout = new(Settings.Default.Https.Timeout);
CancellationTokenSource ctsLinked = CancellationTokenSource.CreateLinkedTokenSource(cancelSource.Token, ctsTimeout.Token);
try
{
return await protocol.ProcessAsync(uri, ctsLinked.Token);
}
catch
{
return (OracleResponseCode.Error, null);
} |
@@ -51,6 +51,7 @@ public async Task<(OracleResponseCode, string)> ProcessAsync(Uri uri, Cancellati | |||
HttpResponseMessage message; | |||
try | |||
{ | |||
int redirects = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shargon, could it be a merge between max redirects and timeout?
And sum the time taken between redirects?
Anyway, this will solve the issue for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we should create a new HttpClient
for each request, because the timeout it's specified in the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use httpclienthandler.maxautomaticredirections ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the original issue, we can have a SSRF
* add invoked contract (#657) * add in file copyright (#679) * witness rule support (#676) * Prevent SSRF (#692) * limit free gas (#697) * add log when exception happens under debug mode (#690) * dbft: tune MaxBlock* parameters (#688) * Fix StateAPI.MakeFindStatesParams (#699) * update Console to ConsoleHelper (#682) * refac log (#700) * Make RpcServer.ProcessAsync public to enable better neo express integration (#701) * Limit result stack (#696) * fix MaxBlockSystemFee (#703) * code optimise (#704) * Add oracle global timeout (#698)
Be compatible with neo-project/neo-modules#698.
Related to #692 (comment)