Make the port optional in <streamhost/>
XEP-0065 section 9.2 says “The "port" attribute specifies the port to connect to. This attribute MAY be present. The value MUST be a valid port number in decimal form. If not specified, the port value is "1080" (in accordance with RFC 1928).” This fixes a traceback when a streamhost is advertised with the default port.
This commit is contained in:
parent
02d9d02fb2
commit
873fa6fdae
|
@ -84,9 +84,13 @@ class Proxy65Manager:
|
|||
for item in query.getChildren():
|
||||
if item.getName() == 'streamhost':
|
||||
host = item.getAttr('host')
|
||||
port = item.getAttr('port')
|
||||
jid = item.getAttr('jid')
|
||||
if not host or not port or not jid:
|
||||
port = item.getAttr('port')
|
||||
try:
|
||||
port = int(port)
|
||||
except ValueError, TypeError:
|
||||
port = 1080
|
||||
if not host or not jid:
|
||||
self.proxies[proxy]._on_connect_failure()
|
||||
self.proxies[proxy].resolve_result(host, port, jid)
|
||||
# we can have only one streamhost
|
||||
|
|
Loading…
Reference in New Issue