8000 Add portfile support by xmo-odoo · Pull Request #7724 · mitmproxy/mitmproxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add portfile support #7724

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

Merged
merged 1 commit into from
May 23, 2025
Merged

Add portfile support #7724

merged 1 commit into from
May 23, 2025

Conversation

xmo-odoo
Copy link
Contributor

Convenient when manipulating mitmproxy programmatically, as it's often useful to specify port 0 (for all sorts of servers) but then the user needs a way to retrieve the actual port being used.

mitmproxy logs the bound ports out by default, however because it logs to the fully buffered stdout and can generate quite a bit of log, this tends to be inconvenient. Writing out a file at a user-specified location makes it much easier for them to poll, and using json even if there is a minor race the user can just keep reading until they see a valid JSON file.

Closes #7720

Convenient when manipulating mitmproxy programmatically, as it's often
useful to specify port 0 (for all sorts of servers) but then the user
needs a way to retrieve the actual port being used.

mitmproxy logs the bound ports out by default, however because it logs
to the fully buffered stdout *and* can generate quite a bit of log,
this tends to be inconvenient. Writing out a file at a user-specified
location makes it much easier for them to poll, and using json even if
there is a minor race the user can just keep reading until they see a
valid JSON file.
Copy link
Member
@mhils mhils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool, thank you! If we see more upvotes on #7720 over time, I'd be willing to consider moving this directly into mitmproxy/addons. But for now this is perfect. 😃

@mhils mhils merged commit 434daba into mitmproxy:main May 23, 2025
27 checks passed
@xmo-odoo xmo-odoo deleted the portfile branch May 26, 2025 07:59
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.

Support creating a pidfile/portfile
2 participants
0