When using --mini and no extension is found, try all of the standard upload extensions.

This commit is contained in:
Matt Martz 2014-04-17 16:20:02 -05:00
parent 5cba294b76
commit 93e13b528f
1 changed files with 13 additions and 0 deletions

View File

@ -663,6 +663,19 @@ class Speedtest(object):
f.close()
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:
raise InvalidSpeedtestMiniServer('Invalid Speedtest Mini Server: '
'%s' % server)