When using --mini and no extension is found, try all of the standard upload extensions.
This commit is contained in:
parent
5cba294b76
commit
93e13b528f
|
@ -663,6 +663,19 @@ class Speedtest(object):
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
extension = re.findall('upload_extension: "([^"]+)"', text.decode())
|
extension = re.findall('upload_extension: "([^"]+)"', text.decode())
|
||||||
|
if not extension:
|
||||||
|
for ext in ['php', 'asp', 'aspx', 'jsp']:
|
||||||
|
try:
|
||||||
|
f = urlopen('%s/speedtest/upload.%s' % (args.mini, ext))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
data = f.read().strip()
|
||||||
|
if (f.code == 200 and
|
||||||
|
len(data.splitlines()) == 1 and
|
||||||
|
re.match('size=[0-9]', data)):
|
||||||
|
extension = [ext]
|
||||||
|
break
|
||||||
if not urlparts or not extension:
|
if not urlparts or not extension:
|
||||||
raise InvalidSpeedtestMiniServer('Invalid Speedtest Mini Server: '
|
raise InvalidSpeedtestMiniServer('Invalid Speedtest Mini Server: '
|
||||||
'%s' % server)
|
'%s' % server)
|
||||||
|
|
Loading…
Reference in New Issue