Merge local changes with default.
This commit is contained in:
commit
dce2ea58b3
1 changed files with 9 additions and 14 deletions
|
@ -35,6 +35,7 @@ import errno
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import base64
|
import base64
|
||||||
|
import urlparse
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger('gajim.c.x.transports_nb')
|
log = logging.getLogger('gajim.c.x.transports_nb')
|
||||||
|
@ -46,25 +47,19 @@ def urisplit(uri):
|
||||||
('http', 'httpcm.jabber.org', 123, '/webclient')
|
('http', 'httpcm.jabber.org', 123, '/webclient')
|
||||||
return 443 as default port if proto is https else 80
|
return 443 as default port if proto is https else 80
|
||||||
'''
|
'''
|
||||||
import re
|
splitted = urlparse.urlsplit(uri)
|
||||||
regex = '(([^:/]+)(://))?([^:/]*)(:)?([^/]*)(/?.*)'
|
proto, host, path = splitted.scheme, splitted.hostname, splitted.path
|
||||||
grouped = re.match(regex, uri).groups()
|
try:
|
||||||
proto, host, port, path = grouped[1], grouped[3], grouped[5], grouped[6]
|
port = splitted.port
|
||||||
|
except ValueError:
|
||||||
|
log.warn('port cannot be extracted from BOSH URL %s, using default port' \
|
||||||
|
% uri)
|
||||||
|
port = ''
|
||||||
if not port:
|
if not port:
|
||||||
if proto == 'https':
|
if proto == 'https':
|
||||||
port = 443
|
port = 443
|
||||||
else:
|
else:
|
||||||
port = 80
|
port = 80
|
||||||
else:
|
|
||||||
try:
|
|
||||||
port = int(port)
|
|
||||||
except ValueError:
|
|
||||||
if proto == 'https':
|
|
||||||
port = 443
|
|
||||||
else:
|
|
||||||
port = 80
|
|
||||||
log.warn('port cannot be extracted from BOSH URL %s, using port %i',
|
|
||||||
uri, port)
|
|
||||||
return proto, host, port, path
|
return proto, host, port, path
|
||||||
|
|
||||||
def get_proxy_data_from_dict(proxy):
|
def get_proxy_data_from_dict(proxy):
|
||||||
|
|
Loading…
Add table
Reference in a new issue