Fix timeout flag inconsistency (#1560)#1724
Fix timeout flag inconsistency (#1560)#17241234-ad wants to merge 1 commit intoprojectdiscovery:devfrom
Conversation
- Replace deprecated Dial with DialContext for proper timeout handling - Add KeepAlive timeout to prevent connection hanging - Ensure consistent timeout application across all HTTP operations - Fix issue where timeout was not being applied consistently Fixes projectdiscovery#1560
WalkthroughThe change modifies HTTP transport and client timeout configurations in the subscraping agent by replacing Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Closing. reason: #1723 |
Description
This PR fixes the timeout flag inconsistency issue reported in #1560 where the
-timeoutoption does not work consistently across runs.Root Cause
The issue was caused by:
Dialmethod instead ofDialContextChanges Made
DialwithDialContextfor proper context-aware timeout handlingTLSHandshakeTimeoutto ensure TLS handshakes respect the timeoutResponseHeaderTimeoutto prevent hanging on slow response headersKeepAlivetimeout to the dialer to prevent connection hangingExpectContinueTimeoutfor better HTTP/1.1 handlingTesting
The fix ensures that all HTTP operations (connection, TLS handshake, response headers) respect the configured timeout value consistently across all runs.
Related Issues
Fixes #1560
Related to #872
Checklist
Summary by CodeRabbit