-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Change resolved Accept-Encoding to honour server side order preferece #49
Conversation
Thank you, @gmokki! Sorry I have been away for a while :( Looking at the change, it doesn't seem like a backwards-compatible change, does it? Mainly, I'm concerned because Express 4.x directly exposes the results of this module, and just do not have the bandwidth to maintain two version lines.
|
You are correct that the change is not backwards compatible. I can put the different sorting order behind an option. However, I'd like to argue that because current top browsers:
Then any user of negotiator.accept(['anything', 'gzip', 'other']) will have always selected gzip. And basically all the other options have been always been ignored. But again, I'll try to add a commit with configurable default so that you can choose take it if you prefer avoiding backwards incompatible changes. |
It doesn't matter what browsers do, as there is no reason why this module would not be used in REST APIs getting requests from non-browser clients. It is a breaking change, regardless of speculation. |
Hi, I just want to point out that I think this change breaks compliance with RFC 2616. I couldn't find anywhere in the RFC that the order of the encodings indicates any kind of preference from the client. But it's explicitly stated in the RFC that:
Even though that sentence refers to the I don't mind honouring client order, but I wouldn't do it at the cost honouring specificity. |
32ecd8f
to
2ac5a24
Compare
I have now rewritten the patch so that the sorting algorithm can be chosen by passing suitable options object. The current algorithm is maintained as the default. Do I need to add similar functionality also to the other parsers or do you think adding options only to encoding parser is acceptable? |
Options: client: use client quality levels and client order for equal quality levels clientThenServer: use client quality levels and server order for equal quality levels server: use server order The 'client' preferred order is the default to match with previous implementation. Signed-off-by: Jonas Berlin <jonas.berlin@nitorcreations.com>
…the browsers. - optimize png images with pngquant (quality 95) and advpng - optimize svg images with svgo - create precompressed variants of js, css, svg files: gz using zopfli and br using brotli Currently using forked versions of expressjs/send/negotiator while waiting for the PRs to go through: - jshttp/negotiator#49 - pillarjs/send#108
…the browsers. - optimize png images with pngquant (quality 95) and advpng - optimize svg images with svgo - create precompressed variants of js, css, svg files: gz using zopfli and br using brotli Currently using forked versions of expressjs/send/negotiator while waiting for the PRs to go through: - jshttp/negotiator#49 - pillarjs/send#108
…the browsers. - create precompressed variants of js, css, svg files: gz using zopfli and br using brotli Currently using forked versions of expressjs/send/negotiator while waiting for the PRs to go through: - jshttp/negotiator#49 - pillarjs/send#108
…the browsers. - create precompressed variants of js, css, svg files: gz using zopfli and br using brotli Currently using forked versions of expressjs/send/negotiator while waiting for the PRs to go through: - jshttp/negotiator#49 - pillarjs/send#108
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This has been sitting for a very long time and looked to be more contentious than I was willing to take on after so long. I landed #59 which appears to cover some of the need here. If someone wants to re-open a smaller change I would be happy to re-assess, but I am going to close this one for now. |
...when comparing client provided encodings with equal quality
Also change the quality of automatically added identity encoding to be lower than other encodings instead of equal to lowest seen quality.
This change is required by pillarjs/send#108 to be able to use the negotiator.