Some fixes for the --mini option.
* Don't fetch speedtest.net configs when using a custom mini server. It don't makes sense and slows down the whole thing. * Add a mising decode() in the variable data, and set both decodes() to ignore encoding errors.
This commit is contained in:
parent
72da41e4fc
commit
b04887ae1a
|
@ -568,6 +568,7 @@ def speedtest():
|
|||
source = args.source
|
||||
socket.socket = bound_socket
|
||||
|
||||
if not args.mini:
|
||||
if not args.simple:
|
||||
print_('Retrieving speedtest.net configuration...')
|
||||
try:
|
||||
|
@ -576,6 +577,7 @@ def speedtest():
|
|||
print_('Cannot retrieve speedtest configuration')
|
||||
sys.exit(1)
|
||||
|
||||
if not args.mini:
|
||||
if not args.simple:
|
||||
print_('Retrieving speedtest.net server list...')
|
||||
if args.list or args.server:
|
||||
|
@ -600,7 +602,7 @@ def speedtest():
|
|||
else:
|
||||
servers = closestServers(config['client'])
|
||||
|
||||
if not args.simple:
|
||||
if not args.simple and not args.mini:
|
||||
print_('Testing from %(isp)s (%(ip)s)...' % config['client'])
|
||||
|
||||
if args.server:
|
||||
|
@ -624,9 +626,9 @@ def speedtest():
|
|||
print_('Invalid Speedtest Mini URL')
|
||||
sys.exit(1)
|
||||
else:
|
||||
text = f.read()
|
||||
text = f.read().decode(errors="ignore")
|
||||
f.close()
|
||||
extension = re.findall('upload_extension: "([^"]+)"', text.decode())
|
||||
extension = re.findall('upload_extension: "([^"]+)"', text)
|
||||
if not extension:
|
||||
for ext in ['php', 'asp', 'aspx', 'jsp']:
|
||||
try:
|
||||
|
@ -636,7 +638,7 @@ def speedtest():
|
|||
except:
|
||||
pass
|
||||
else:
|
||||
data = f.read().strip()
|
||||
data = f.read().decode(errors="ignore").strip()
|
||||
if (f.code == 200 and
|
||||
len(data.splitlines()) == 1 and
|
||||
re.match('size=[0-9]', data)):
|
||||
|
|
Loading…
Reference in New Issue