Display the hostname instead of ip address, and improve the host parse for
ipv6 address
This commit is contained in:
1 parent
1f07217712
commit
c10a29d200
2 files changed
+9
-7
No files matched your search
+5
-5
@@ -149,7 +149,7 @@ class DBLogin(object):
|
||||
i = liststore.iter_next(i)
|
||||
|
||||
res = win.run()
|
||||
url_m = re.match('^([\w.\-]+):(\d{1,5})$',
|
||||
url_m = re.match('^([\w.:\-\d]+):(\d{1,5})$',
|
||||
server_widget.get_text() or '')
|
||||
if url_m:
|
||||
CONFIG['login.server'] = url_m.group(1)
|
||||
@@ -685,7 +685,7 @@ class Main(object):
|
||||
self.sb_username.push(sb_id, prefs['name'] or '')
|
||||
sb_id = self.sb_servername.get_context_id('message')
|
||||
self.sb_servername.push(sb_id, '%s@%s:%d' % (rpc._USERNAME,
|
||||
rpc._SOCK.host, rpc._SOCK.port))
|
||||
rpc._SOCK.hostname, rpc._SOCK.port))
|
||||
if not prefs[menu_type]:
|
||||
if quiet:
|
||||
return False
|
||||
@@ -859,7 +859,7 @@ class Main(object):
|
||||
if not dbname:
|
||||
return
|
||||
|
||||
host, port = url.split(':')
|
||||
host, port = url.rsplit(':', 1)
|
||||
|
||||
try:
|
||||
rpc.db_exec(host, int(port), 'drop', passwd, dbname)
|
||||
@@ -881,7 +881,7 @@ class Main(object):
|
||||
file_p = file(filename, 'rb')
|
||||
data_b64 = base64.encodestring(file_p.read())
|
||||
file_p.close()
|
||||
host, port = url.split(':')
|
||||
host, port = url.rsplit(':' , 1)
|
||||
res = rpc.db_exec(host, int(port), 'restore', passwd, dbname,
|
||||
data_b64)
|
||||
if res:
|
||||
@@ -936,7 +936,7 @@ class Main(object):
|
||||
preview=False)
|
||||
|
||||
if filename:
|
||||
host, port = url.split(':')
|
||||
host, port = url.rsplit(':', 1)
|
||||
dump_b64 = rpc.db_exec(host, int(port), 'dump', passwd, dbname)
|
||||
dump = base64.decodestring(dump_b64)
|
||||
file_ = file(filename, 'wb')
|
||||
|
||||
+4
-2
@@ -34,7 +34,8 @@ class PySocket:
|
||||
def connect(self, host, port=False):
|
||||
if not port:
|
||||
buf = host.split('//')[1]
|
||||
host, port = buf.split(':')
|
||||
host, port = buf.rsplit(':', 1)
|
||||
hostname = host
|
||||
if host in DNS_CACHE:
|
||||
host = DNS_CACHE[host]
|
||||
if not self.sock:
|
||||
@@ -48,7 +49,7 @@ class PySocket:
|
||||
self.sock = socket.socket(familly, socket.SOCK_STREAM)
|
||||
self.sock.settimeout(120)
|
||||
self.sock.connect((host, int(port)))
|
||||
DNS_CACHE[host], port = self.sock.getpeername()[:2]
|
||||
DNS_CACHE[hostname], port = self.sock.getpeername()[:2]
|
||||
try:
|
||||
familly = socket.AF_INET
|
||||
if socket.has_ipv6:
|
||||
@@ -67,6 +68,7 @@ class PySocket:
|
||||
if self.ssl:
|
||||
self.ssl_sock = socket.ssl(self.sock)
|
||||
self.host = host
|
||||
self.hostname = hostname
|
||||
self.port = port
|
||||
|
||||
def disconnect(self):
|
||||
|
||||
Reference in new issue
Block a user