use default port for bosh proxy when none is provided. Fixes #5400, #5401

This commit is contained in:
Yann Leboulanger 2009-11-04 21:17:57 +01:00
parent 124483ea49
commit 4343d706a0
1 changed files with 12 additions and 3 deletions

View File

@ -56,9 +56,18 @@ def get_proxy_data_from_dict(proxy):
proxy_type = proxy['type'] proxy_type = proxy['type']
if proxy_type == 'bosh' and not proxy['bosh_useproxy']: if proxy_type == 'bosh' and not proxy['bosh_useproxy']:
# with BOSH not over proxy we have to parse the hostname from BOSH URI # with BOSH not over proxy we have to parse the hostname from BOSH URI
tcp_host = urisplit(proxy['bosh_uri'])[1] proto, tcp_host, path = urisplit(proxy['bosh_uri'])
tcp_host, tcp_port = tcp_host.split(':', 1) spl = tcp_host.split(':', 1)
tcp_port = int(tcp_port) if len(spl) == 1:
# No port were set
tcp_host = tcp_host[0]
if proto == 'https':
tcp_port = 443
else:
tcp_port = 80
else:
tcp_host, tcp_port = spl
tcp_port = int(tcp_port)
else: else:
# with proxy!=bosh or with bosh over HTTP proxy we're connecting to proxy # with proxy!=bosh or with bosh over HTTP proxy we're connecting to proxy
# machine # machine