Skip to content

[FR] Support listening to an ephemeral port 0 #617

@webknjaz

Description

@webknjaz

Is your feature request related to a problem? Please describe.

If I pass the port 0 to proxy.py when running it programmatically via the context manager Proxy, there's no way of accessing the actual port the kernel allocates.

Describe the solution you'd like

I want to run proxy.py with an ephemeral port so that each time it'd get a guaranteed unoccupied port from the OS kernel. This is useful in the context of testing where I don't want to have a hardcoded port to avoid conflicts / race conditions with other processes.

I've skimmed though the code and it seems easy to implement. If you green-light this feature, I may even send you a PR myself.

Describe alternatives you've considered

Giving up or monkey-patching stuff.

Additional context

I'm trying to use proxy.py in a test suite for a web framework.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions