The Wayback Machine - https://web.archive.org/web/20210112091352/https://github.com/expressjs/compression/pull/27
Skip to content
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 option to specify available encodings #27

Open
wants to merge 1 commit into
base: master
from

Conversation

@gfemec
Copy link

@gfemec gfemec commented Jan 1, 2015

closes #25

Greg Femec
closes #25
@hex7c0
Copy link

@hex7c0 hex7c0 commented Jan 26, 2015

+1

@@ -157,7 +158,7 @@ function compression(options) {

// compression method
var accept = accepts(req)
var method = accept.encoding(['gzip', 'deflate', 'identity'])
var method = accept.encoding(available)

// negotiation failed
if (!method || method === 'identity') {

This comment has been minimized.

@Fishrock123

Fishrock123 Jan 26, 2015
Member

Correct me if I'm wrong, but I think it always needs to have the identity fallback.

This comment has been minimized.

@hex7c0

hex7c0 Jan 26, 2015

right
if you want disable deflate algorithm, you should use ['gzip', 'identity']

This comment has been minimized.

@dougwilson

dougwilson Jan 26, 2015
Member

Right. I'm not sure if the interface should make the user include identity

This comment has been minimized.

@hex7c0

hex7c0 Jan 26, 2015

before force identity, people should check the presence of their algorithms inside this module

worst case? ciao like a new superpowerful algorithm :)
['ciao', 'identity'] as option
ab -v 4 -H "Accept-Encoding: ciao" -c 1 -n 1 127.0.0.1:3000/with_compression

LOG: header received:
HTTP/1.1 200 OK
Content-Type: text/plain
Vary: Accept-Encoding
Content-Encoding: ciao
Date: Mon, 26 Jan 2015 18:59:20 GMT
Connection: close

sent with deflate algorithm https://github.com/expressjs/compression/blob/master/index.js#L172

This comment has been minimized.

@dougwilson

dougwilson Jan 26, 2015
Member

@hex7c0 , right, that is another case that needs to be fixed and why this PR hasn't been merged just yet :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants
You can’t perform that action at this time.