GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat: add default option by bjohansebas · Pull Request #191 · expressjs/compression Conversation
|
|
Hi @IamLizu, could you review this PR? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hey @bjohansebas 👋 Sure, I will read the relevant issues and then review this PR 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hi @bjohansebas 👋
I'm generally 👍 of the concept of introducing an enforcement mechanism, as discussed in #83.
However, would you mind renaming the variable defaultEnconfig to something that doesn't conflict with zlib.createGzip or zlib.createDeflate? It seems this conflict may have led to the addition of the following block:
if (opts.defaultEncoding) { opts.defaultEncoding = undefined }
I suggest enforceEncoding, more on this below. Renaming the variable would help keep the code clean, and it’s important that we avoid such conflicts.
Thanks so much for your understanding and effort!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@IamLizu Good catch |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There's something I should address. As we know, content negotiation is handled by negotiator here, and it is indeed negotiator's responsibility to choose the best method.
Maybe we are interfering with negotiator's responsibilities?
cc: @expressjs/express-tc
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@UlisesGascon ping |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
|
||
| // if no method is found, use the default encoding | ||
| if (encodingSupported.indexOf(enforceEncoding) !== -1 && !req.headers['accept-encoding']) { | ||
| method = enforceEncoding === '*' ? 'gzip' : enforceEncoding |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I dont see * referenced anywhere but here. Can you describe why this is necessary when you could drop this check and just have folks pass gzip directly for this?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
If * is not checked and changed, the deflate encoding would be applied as it’s the last one in the check (
Lines 196 to 198 in 66c0cb7
| stream = method === 'gzip' | |
| ? zlib.createGzip(opts) | |
| : zlib.createDeflate(opts) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry but I don't follow your description? To me it looks like this value for the option (coming from the calling code) could just be dropped entirely.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I haven't found a way to eliminate this check.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@wesleytodd Is there any change I need to make? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like this was merged with a pending "change requested" review. Is that the case?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| // if no method is found, use the default encoding | ||
| if (encodingSupported.indexOf(enforceEncoding) !== -1 && !req.headers['accept-encoding']) { | ||
| method = enforceEncoding === '*' ? 'gzip' : enforceEncoding |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry but I don't follow your description? To me it looks like this value for the option (coming from the calling code) could just be dropped entirely.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry for merging this with a change request, I now know I need to wait until the approval is there. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Force compression to client don't work
There was an error while loading. Please reload this page.