-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix compression headers #665
Comments
Actually, after doing some research, I think that our implementation follows the specification/standards: https://www.rfc-editor.org/rfc/rfc9110#name-content-encoding
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
The key point seems to be "without losing information about the origin media type". Browsers AFAIK don't support zstd (also curl does not display the data because "binary data might mess with your terminal"). If we set the I'd argue that the current implementation is fine, so I'll move this to blocked until we decide that we still want to change it. |
If a user does not set The logic for the This is similar to our |
The current implementation doesn't work, does it? The user should be able to go to a particular link in their browser and the browser should then download a GZIP or ZSTD compressed file in the sense that it puts a compressed file onto their disk. As the feature is very important and needed for our other project, I'll put it back into prioritized. |
So the feature is actually about downloading the file instead of showing it in the browser? This can already be achieved by setting Should we make We could also simply mention in the docs that usually you want to |
This doesn't work in (current and older) versions of Chrome: In future versions or if you enable zstd in Chrome's settings (https://caniuse.com/?search=zstd), it works.
If a user asks for a gzipped TSV file (which is not the same as asking for a TSV file which may be encoded as a GZIP or not), then they should receive a GZIP file. Showing it in a decompressed format shall not be considered a right way to display the content. (A "correct" way could be to show the binary in a hex format but of course, no browser does that.) I think that we should fully separate the query parameters from the |
I just tried https://lapis.cov-spectrum.org/gisaid/v2/sample/aggregated?accessKey=9C[...]Pd&downloadAsFile=true&compression=zstd. It triggers a download, both in Firefox (123.0) and Chrome (122.0.6261.94). As we figured out, it works in Chrome, because the Linux build has the zstd flag enabled and tries to decompress zstd. If the flag is disabled, Chrome will show a failed request (even though it was successful - ignoring the As dicsussed, we will change it to overwrite the |
…ession property in the request was set #665 That way we lose information about the actual content of the request, but Chrome downloads zstd encoded data instead of failing to display it.
…ession property in the request was set #665 That way we lose information about the actual content of the request, but Chrome downloads zstd encoded data instead of failing to display it.
…e compression property in the request was set #665
…e compression property in the request was set #665
…ession property in the request was set #665 That way we lose information about the actual content of the request, but Chrome downloads zstd encoded data instead of failing to display it.
…ession property in the request was set #665 That way we lose information about the actual content of the request, but Chrome downloads zstd encoded data instead of failing to display it.
Currently, when we go to
aggregated?compression=gzip
, we get a response withSimilarly, if choosing
?compression=zstd
, one get a response with aContent-Encoding: zstd
. Opening in a browser, this causes an error:I think that the headers are actually quite wrong. If someone requests a compressed file, then the content is not JSON (or TSV or FASTA) but it's a GZIP or ZSTD file. I.e., there shouldn't be a
Content-Encoding
and theContent-Type
should beapplication/gzip
orapplication/zstd
(I checked that both are official IANA media types) or maybe justapplication/octet-stream
.The text was updated successfully, but these errors were encountered: