Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.