Browse Source

interface: hostname cannot be empty

3.3.3.1
SomberNight 6 years ago
parent
commit
adc91eb75e
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 3
      electrum/interface.py

3
electrum/interface.py

@ -115,10 +115,11 @@ class ErrorParsingSSLCert(Exception): pass
class ErrorGettingSSLCertFromServer(Exception): pass
def deserialize_server(server_str: str) -> Tuple[str, str, str]:
# host might be IPv6 address, hence do rsplit:
host, port, protocol = str(server_str).rsplit(':', 2)
if not host:
raise ValueError('host must not be empty')
if protocol not in ('s', 't'):
raise ValueError('invalid network protocol: {}'.format(protocol))
int(port) # Throw if cannot be converted to int

Loading…
Cancel
Save