Skip to content

Allow to use random TCP port #23

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

Closed
wants to merge 1 commit into from
Closed

Conversation

PMox
Copy link

@PMox PMox commented Nov 24, 2017

You can have the system to allocate a random free TCP port by providing a value of "0" (int) to the port.

If you try this in the current code, the callback fails because the URL hardcode port "0", which is wrong.

This is quite easy to fix, by performing these two operations:

  1. create the redirect URL only after having created the HTTP server
  2. retrieve the TCP port from the HTTP server rather than from the configuration, and use the new value for the redirect URL

You can have the system to allocate a random free TCP port by providing a value of "0" (int) to the port.

If you try this in the current code, the callback fails because the URL hardcode port "0", which is wrong.

This is quite easy to fix, by performing these two operations:
1) create the redirect URL only after having created the HTTP server
2) retrieve the TCP port from the HTTP server rather than from the configuration, and use the new value for the redirect URL
@PMox
Copy link
Author

PMox commented Nov 24, 2017

Interesting.

As per Python 2 doc wsgiref.simple_server "implements a simple HTTP server (based on BaseHTTPServer) that serves WSGI applications", so this should not only works, but also it's expected to work... I think the issue is in the Mock object used in the test.

@wrouesnel
Copy link

+1 for this - I just tried to use port 0 because that's the normal way to get a random free port reliably.

@theacodes
Copy link

Does this cause issues with the registered callback URL?

@wrouesnel
Copy link

No it does not - the google implementation explicitly allows random ports for local host.

@theacodes
Copy link

theacodes commented Jul 24, 2018 via email

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Mar 13, 2019
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Jul 3, 2019
@busunkim96
Copy link
Contributor

Superseded by #33

@busunkim96 busunkim96 closed this Aug 2, 2019
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.

5 participants