Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gzip'd Response causes Failed File Size Check #9

Closed
savionlee opened this issue Dec 28, 2023 · 4 comments
Closed

Gzip'd Response causes Failed File Size Check #9

savionlee opened this issue Dec 28, 2023 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@savionlee
Copy link

Expected Behavior

File Size check should deflate the url response to compute size if content-encoding: gzip is in the headers

Current Behavior

File size is taken from the content-length. Since the file on the server was sent as compressed, it is smaller than the file to be checked.

Possible Solution

The file downloads to the correct size, so maybe it gets downloaded with a temporary extension, after it completes, we check the file size of the temporary. Afterwards, remove the temporary extension before the md5 check.

Alternatively, I found this stackexchange that says to deflate and then do what you want. https://stackoverflow.com/questions/20537432/force-webserver-to-return-uncompressed-data-no-gzip

Steps to Reproduce

  1. fresh install
  2. download 10, use wine app image
  3. wait till it gets to wine tricks
  4. see error

Context (Environment)

Fedora 39, GNOME Wayland

Detailed Description

On a fresh install, the installer fails with error

2023-12-28 16:05:42 CRITICAL: Bad file size or checksum: /home/user1/Downloads/winetricks

In debug log, it shows a smaller url_size than after the size of the file downloaded:

2023-12-28 15:39:46 DEBUG: url_size = 191443 B; file_size = 904682 B

Examining the headers in firefox, github is responding with a gzip compression, so this line is returning a compressed value to be judged by the same_file size

Headers to the raw file:

HTTP/2 200 
content-encoding: gzip
content-length: 191443
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"6ea1078523c73e321b37fc6db2781620d63401e3320f9033c20d9b6d4fcc0c48"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: D7C2:63A2:3A603F:47A7B1:658DEB1C
accept-ranges: bytes
date: Thu, 28 Dec 2023 22:58:02 GMT
via: 1.1 varnish
x-served-by: cache-dfw-kdfw8210092-DFW
x-cache: HIT
x-cache-hits: 1
x-timer: S1703804282.138054,VS0,VE105
vary: Authorization,Accept-Encoding,Origin
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 1fb49f40c6dfdaa7a8f773e397fb219cd5dd68f6
expires: Thu, 28 Dec 2023 23:03:02 GMT
source-age: 0
X-Firefox-Spdy: h2

LogosLinuxInstaller/utils.py Line 92

        content_length = self.headers.get('Content-Length')

Possible Implementation

@thw26 thw26 added the bug Something isn't working label Dec 28, 2023
@thw26 thw26 added this to the Beta milestone Dec 28, 2023
@thw26 thw26 added the alpha label Dec 28, 2023
@godfollower
Copy link

Also present using Debian 12 with a clean install/appimage selected

@n8marti
Copy link
Collaborator

n8marti commented Dec 29, 2023

Thanks for the clear problem description and helpful link, @savionlee. I have posted the above commit, 085d119, in a branch, but this needs testing in a clean system. I may have time later today, but not at the moment.

@n8marti
Copy link
Collaborator

n8marti commented Dec 30, 2023

Here's a test build (binary executable) that includes the commit, give it a try if you can: https://github.com/FaithLife-Community/test-builds/releases/download/v4.0.0alpha-issue9-20231230-78001b1c/LogosLinuxInstaller

@savionlee
Copy link
Author

Installer made it all the way through with that patch. No error on file size. @n8marti

n8marti added a commit that referenced this issue Dec 30, 2023
fix #9: gzip server reply gives compressed file size instead of disk size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants