So ZLIB f'd the size. I fixed the size. :)

This commit is contained in:
Victorious Children Studios 2023-12-20 00:32:07 +02:00
parent 3ff1411c18
commit cd853f42aa
2 changed files with 14 additions and 1 deletions

View file

@ -88,6 +88,15 @@ def down(win, website, filename, fsize=100000):
url = website+"/download_z"+filename url = website+"/download_z"+filename
response = urllib.request.urlopen(url) response = urllib.request.urlopen(url)
for line in str(response.info()).split("\n"):
if line.startswith("Content-length: "):
try:
fsize = int(line[line.find(" ")+1:])
except:
pass
savef = open(win.project+filename, "wb") savef = open(win.project+filename, "wb")

View file

@ -232,10 +232,14 @@ class handler(BaseHTTPRequestHandler):
if os.path.exists(fullfilename): if os.path.exists(fullfilename):
self.start_page(200) self.start_page(200)
self.send_header('Content-type', mimetypes.guess_type(filename)) self.send_header('Content-type', mimetypes.guess_type(filename))
self.end_headers()
f = open(fullfilename, "rb") f = open(fullfilename, "rb")
f = f.read() f = f.read()
z = zlib.compress(f) z = zlib.compress(f)
self.send_header('Content-length', len(z))
self.end_headers()
self.wfile.write(z) self.wfile.write(z)
else: else:
self.start_page(404) self.start_page(404)