-
Notifications
You must be signed in to change notification settings - Fork 909
fix(download): allow highly compressed responses up to a known file size #9146
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
Conversation
Qt 6.2+'s archive bomb check is cool and all, but it's really annoying when trying to retrieve files that compress really well over the wire. As we already know the expected file size before the request we can basically tell Qt to allow decompression of responses up to the expected file size and a bit to spare. Signed-off-by: Jyrki Gadinger <[email protected]>
|
/backport to stable-4.0 |
mgallien
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
really nice automated test
easy to understand how it works
Unfortunately faking this with the usual methods won't do the trick: setting an override in our FakeQNAM returning a faked reply completely bypasses Qt's internal routines for QNetworkReply. Therefore: spin up a temporary local HTTP server for the time of the test and do real HTTP requests. We could try to explore how useful QHttpServer would be in other tests in the future as well, it might enable us for a cleaner way of setting up a fake/mock server for unit tests. For now this specific test can be seen as the initial exploration on how it could be used. Caveat: this test is only available if the QHttpServer component is present, chances are it may not run everywhere. Signed-off-by: Jyrki Gadinger <[email protected]>
1be1bf5 to
14b0258
Compare
|
Artifact containing the AppImage: nextcloud-appimage-pr-9146.zip Digest: To test this change/fix you can download the above artifact file, unzip it, and run it. Please make sure to quit your existing Nextcloud app and backup your data. |
|




Follow-up for #8333
We already know the expected file size before the request, so we pretty much just™ can tell Qt to allow the decompression of responses up to the expected file size (and a bit to spare).
To cover this behaviour through unit tests I unfortunately ran into a limitation when trying to fake the requests with the usual methods: setting an override in our FakeQNAM returning a faked reply completely bypasses Qt's internal routines for QNetworkReply.
Therefore: spin up a temporary local HTTP server for the time of the test and do real HTTP requests.
We could try to explore how useful QHttpServer would be in other tests in the future as well, it might enable us for a cleaner way of setting up a fake/mock server for unit tests. For now this specific test can be seen as the initial exploration on how it could be used.
Caveat: this test is only available if the QHttpServer component is present, chances are it may not run everywhere. Hope CI is still fine with that...
Tested locally on Linux + Windows (both virtual files and classic sync) as well. To run into this issue I did the following:
.htaccessof my AIO installation; even with Brotli the compression ratio is large enough to run into thisSetOutputFilter BROTLI_COMPRESSbefore this change: the client failed to download the file with the well-known
Decompression failed: The decompressed output exceeds the limits specified by QNetworkRequest::decompressedSafetyCheckThreshold()errorafter this change: the client downloaded the file just fine