Skip to content
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

Use urllib to parse the URL for the host and port #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DarioBianco
Copy link

Parse the received URL string with urllib.parse.urlparse() to extract the hostname and port number (instead of splitting the URL to extract the hostname and port).

parse_remote() previously split the host string with ":" to get the host and port number, but splitting may result in a list of 3 strings (e.g., 'ws://192.168.4.1:8266' would become ['ws', '//192.168.4.1', '8266']. The code would crash because of the double forward slashes at the beginning of the host string.

Parse the received URL string with urllib.parse.urlparse() to extract the hostname and port number (instead of splitting the URL to extract the hostname and port).

parse_remote() previously split the host string with ":" to get the host and port number, but splitting may result in a list of 3 strings (e.g., 'ws://192.168.4.1:8266'  would become ['ws', '//192.168.4.1', '8266']. The code would crash because of the double forward slashes at the beginning of the host string.
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.

None yet

1 participant