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
Choose a base branch
from

Conversation

gfemec
Copy link

@gfemec gfemec commented Jan 1, 2015

closes #25

@hex7c0
Copy link

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') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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
Development

Successfully merging this pull request may close these issues.

option to disable DEFLATE encoding
4 participants