webrepl
webrepl copied to clipboard
Use urllib to parse the URL for the host and port
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.