diff --git a/MicroWebSrv2/httpResponse.py b/MicroWebSrv2/httpResponse.py index 3d5fbe1..034a412 100644 --- a/MicroWebSrv2/httpResponse.py +++ b/MicroWebSrv2/httpResponse.py @@ -353,10 +353,15 @@ def ReturnFile(self, filename, attachmentName=None) : if attachmentName is not None and not isinstance(attachmentName, str) : raise ValueError('"attachmentName" must be a string or None.') try : - size = stat(filename)[6] + size = stat(filename+".gz")[6] + filename += ".gz" + self.SetHeader('Content-Encoding', 'gzip') except : - self.ReturnNotFound() - return + try : + size = stat(filename)[6] + except : + self.ReturnNotFound() + return try : file = open(filename, 'rb') except :