Internet: use binary I/O.

This commit is contained in:
Valentin Lorentz 2012-08-04 20:07:24 +02:00
parent 978a702346
commit 0b49c7312f

View File

@ -83,12 +83,13 @@ class Internet(callbacks.Plugin):
except socket.error, e: except socket.error, e:
irc.error(str(e)) irc.error(str(e))
return return
t.write(domain) t.write(domain.encode('ascii'))
t.write('\r\n') t.write(b'\r\n')
s = t.read_all() s = t.read_all()
server = registrar = updated = created = expires = status = '' server = registrar = updated = created = expires = status = ''
for line in s.splitlines(): for line in s.splitlines():
line = line.strip() line = line.decode('ascii').strip()
print(repr(line))
if not line or ':' not in line: if not line or ':' not in line:
continue continue
if not server and any(line.startswith, self._domain): if not server and any(line.startswith, self._domain):
@ -121,13 +122,13 @@ class Internet(callbacks.Plugin):
except socket.error, e: except socket.error, e:
irc.error(str(e)) irc.error(str(e))
return return
t.write('registrar ') t.write(b'registrar ')
t.write(registrar.split('(')[0].strip()) t.write(registrar.split('(')[0].strip().encode('ascii'))
t.write('\n') t.write(b'\n')
s = t.read_all() s = t.read_all()
url = '' url = ''
for line in s.splitlines(): for line in s.splitlines():
line = line.strip() line = line.decode('ascii').strip()
if not line: if not line:
continue continue
if line.startswith('Email'): if line.startswith('Email'):