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 brotli encoding #228
Conversation
@thornjad pretty sure adding |
I believe the stat call currently happens with gzip, fwiw |
Yes, I modeled it on the way gzip was already implemented, and only making the |
possibly relevant https://github.com/jfhbrook/node-ecstatic/pull/195/files |
How does this look to everyone? Are there any objections? |
No immediate concerns, but I'd like to take a closer look and kick the tires on this just the same |
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.
Hey, so I did a real review and this looks pretty good! I want to make the brotli encoding off by default so as to not change the default API contract, but that's a pretty minor thing. We'll need documentation as well.
If you can do these things, great! If not, let me know and I can probably push this the rest of the way.
Thanks for your work on this! Neat feature.
Documentation added! Thank you for reviewing! |
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.
I'll ship this later tonight!
Hey, so uh, after merging this I get multiple test fails on Windows @thornjad , can you reproduce (on any platform, maybe not win-specific) ? I can track down this failure but not right now, maybe in the next day or two, but knowing if it's just me will help. |
|
Very weird. Yes I can reproduce this on Linux, I'm going to see if I get the same on an entirely fresh install on Windows. The weird part is that I don't get the same test failures on my fork. |
ok word so it's probably not a windows-specific issue. You don't have to try to repro on windows specifically in that case, imo. and yeah, frickin' weird right?? |
Ready for a new kicker? I just pulled master into the master on my fork, and? No error. I'm going to try to investigate this now if I have enough time. |
wondering if it has to do with line endings |
y'know \n vs \r\n, git pulls some shenanigans on text files to make them happy this way |
also, check for accidentally uncommitted things, maybe you have a delta or a new file somewhere |
Nothing uncommitted. I've seen line endings messed up in git before, and it doesn't look like that's the case, but I don't know how to check for sure. |
I'm not 100% on that either, maybe a regexp search for \n vs \r\n ? or we use a binary upload/download site and run diff? |
With some experimentation, it looks like in those two test cases, where brotli is not accepted and where brotli is not enabled, it isn't falling back on gzip like it should. For example, when I go to test/public/brotli in firefox (which doesn't support brotli without https), I get the uncompressed index file. As for differences, I used |
Possible there's a race condition? |
I've found the problem, and it's frustratingly simple! Both of those tests are attempting to serve Because of #230, how should I submit this change? Should it be a new PR? |
let's try this:
A little "hold my beer" but I think that'll have the correct behavior in terms of playing nice w/ git and github. |
You can pull this branch locally from my upstream, then cherry-pick the fix in and it should do the right thing |
Published 3.3.0, cheers! |
Brotli encoding is a relatively new compression algorithm which may be better than gzip, and is supported by all major browsers according to Wikipedia. This patch adds support for ecstatic to serve brotli-encoded files (using the .br extension) if the browser supports it.
Some things to note: