-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add support for being able to detect a brotli-compressed file? #867
Comments
AFAIK Dropbox has a port It's meant to be compatible as a C drop-in replacement of this project AFAIK, but I'm not sure if it's been keeping in sync, so it might have diverged a bit. It has a few other additions too. |
Nice idea. Going to add comment feature soon. |
Comment (or any variable-length part really) is also useful for HTB, the mitigation used to add randomness to packet sizes and mess with the BREACH exploit. |
Hey @eustas , I wonder if that comment feature got added? Your post above suggests that it would have been something that was favorable to carry upstream? |
Done. See |
Identifying a gzip-compressed file is super-easy by checking whether the file starts with magic bytes
1F
and8B
. (ignoring false positives etc.)It has been discussed before that Brotli is a stream that does not have such magic bytes. That has led to other projects not being able to move forward, such as
file
andlibmagic
tools not being able to detect Brotli compressed content (#727).There was a proposal for a Brotli framing format at https://github.com/madler/brotli/blob/master/br-format-v3.txt , but if I understand its latest status correctly, it was just a proposal, with no actual plan or possibility to move forward, as it would break binary compatibility with existing Brotli compressed content? (so e.g. Chrome, Firefox and Safari would need to add support for this new framed format?) Is that accurate?
It seems based on #462 and #298 that the request to add a magic number or an official framing was dropped, with no plans to actually go forward with either?
If so, and adding magic numbers and/or official framing is not on the table anymore, I would like to propose an alternative feature that would at least work for some users' use cases, and retain the existing binary compatibility.
Unity is using a mechanism that enables embedding an uncompressed comment string into the Brotli binary. See the local code modification here: Unity-Technologies@5a6d5d9
That enables a
brotli
compressor to receive a string--comment "UnityWeb Compressed Content (brotli)"
on the command line, which gets embedded to the stream. Unity is then using the following JavaScript code in a browser context to detect .br compressed files:Would it be possible for this to become an officially supported feature in the command line executable brotli compressor? E.g. if one runs
that would emit the given comment into the output file. Then users would be able to identify at least their own generated .br files - or if a compressor is used within a certain community (say among Emscripten developers), tooling could be used within that scope to develop detectable .br files?
That way people who oppose adding magic numbers or framing would not have their .br file size increase, but people would still be able to identify their generated .br files.
The text was updated successfully, but these errors were encountered: