Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@keshavkrishna
Copy link

Description

Make TCP inactivity timeout configurable

Previously, mitmproxy used a hardcoded TCP inactivity timeout of 10 minutes (600 seconds) for all TCP connections. This change makes the timeout configurable through a new tcp_timeout option, allowing users to adjust the timeout based on their specific use cases.

Changes:

  • Added tcp_timeout option to mitmproxy/options.py with default value of 600 seconds
  • Updated mitmproxy/proxy/server.py to use the configurable timeout instead of hardcoded TCP_TIMEOUT
  • Added command-line support for the new option in mitmproxy/tools/cmdline.py
  • Added comprehensive tests for the new option in test/mitmproxy/test_options.py
  • Updated web interface TypeScript definitions to include the new option

Usage:

# Set TCP timeout to 5 minutes
mitmproxy --set tcp_timeout=300

# Set TCP timeout to 30 minutes  
mitmproxy --set tcp_timeout=1800

This change maintains backward compatibility by keeping the same default timeout value while providing the flexibility to adjust it for different network environments and use cases.

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.md

@keshavkrishna keshavkrishna marked this pull request as ready for review October 12, 2025 04:48
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.

1 participant