-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
introduce timeouts config in types.Options #5228
Conversation
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.
looks like there are more hardcoded timeouts apart from the existing ones i think it would be great to update these as well
// execute with context and timeout
ctx, cancel := context.WithTimeoutCause(opts.Context, time.Duration(opts.Timeout)*time.Second, ErrJSExecDeadline)
defer cancel()
^ in js/compiler/compiler.go this should be equal to JsCompilerExecTimeout
ctx, cancel := context.WithTimeoutCause(input.Context(), time.Duration(timeout)*time.Second, ErrCodeExecutionDeadline)
defer cancel()
^ code protocol i think we intended code protocol timeout to be 3 x -timeout
-
derive pageTimeout from timeout variants ( ideally 3 * -timeout )
-
improve flag description of
-irt, -input-read-timeout value
i thought it was related to network protocol but it is actually a timeout for stdin read
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.
changes + merge conflict + test failure
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.
lgtm !
now all timeouts are stored in Timeouts
struct which is pluggable ( not required and derived from -timeout but can manually be specified via SDK for more control ) .
All Known Timeouts and their default values
// Timeouts is a struct that contains all the timeout variants for nuclei
// dialer timeout is used to derive other timeouts
type Timeouts struct {
// DialTimeout for fastdialer (default 10s)
DialTimeout time.Duration
// Tcp(Network Protocol) Read From Connection Timeout (default 5s)
TcpReadTimeout time.Duration
// Http Response Header Timeout (default 10s)
// this timeout prevents infinite hangs started by server if any
// this is temporarily overridden when using @timeout request annotation
HttpResponseHeaderTimeout time.Duration
// HttpTimeout for http client (default -> 3 x dial-timeout = 30s)
HttpTimeout time.Duration
// JsCompilerExec timeout/deadline (default -> 2 x dial-timeout = 20s)
JsCompilerExecutionTimeout time.Duration
// CodeExecutionTimeout for code execution (default -> 3 x dial-timeout = 30s)
CodeExecutionTimeout time.Duration
}
Caution
This change removes below cli flags
-dt, -dialer-timeout value timeout for network requests.
-rrt, -response-read-timeout value response read timeout in seconds (default 5s)
Proposed changes
Closes #5214
Checklist