Skip to content
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

feat: added support for context cancellation to engine #5096

Merged
merged 11 commits into from
Apr 25, 2024

Conversation

Ice3man543
Copy link
Member

@Ice3man543 Ice3man543 commented Apr 24, 2024

Proposed changes

  • nuclei now support for context cancellation to engine
  • nuclei now use more granular timeouts than a global http timeout to better identify and track errors

Before:

  • HTTP Timeout (Default) = 10s

After:

  • Http Timeout (Default) = 3 * 10s
  • ResponseHeaderTimeout = 5 sec

ResponseHeaderTimeout specifies time to wait before receiving the first response header

  • timeout awaiting response headers is now included in max-host-error ( this only happens for very slow hosts or infinite hang )

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@tarunKoyalwar
Copy link
Member

New updates

  • we now use more granular timeouts than a global http timeout to better identify and track errors

Before:

  • HTTP Timeout (Default) = 10s

After:

  • Http Timeout (Default) = 3 * 10s
  • ResponseHeaderTimeout = 5 sec

ResponseHeaderTimeout specifies time to wait before receiving the first response header

  • timeout awaiting response headers is now included in max-host-error ( this only happens for very slow hosts or infinite hang )

@tarunKoyalwar
Copy link
Member

tarunKoyalwar commented Apr 24, 2024

Follow-up Ticket Idea

  • context deadline exceeded is too vague of error considering we have context propogated throughout nuclei and context with timeouts are used at various places.

  • i suggest we remove context.WithTimeout and replace it with newly introduced timeout with cause https://pkg.go.dev/context#WithTimeoutCause , that way we show/get actual reason why error happened (from cause) instead of just context deadline exceeded

cc: @Ice3man543

@ehsandeep ehsandeep merged commit 0b82e8b into dev Apr 25, 2024
12 checks passed
@ehsandeep ehsandeep deleted the context-cancel-support-engine branch April 25, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

added support for context cancellation to engine
4 participants