add option to specify available encodings #27
Conversation
+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') { |
Fishrock123
Jan 26, 2015
Member
Correct me if I'm wrong, but I think it always needs to have the identity fallback.
Correct me if I'm wrong, but I think it always needs to have the identity fallback.
hex7c0
Jan 26, 2015
right
if you want disable deflate
algorithm, you should use ['gzip', 'identity']
right
if you want disable deflate
algorithm, you should use ['gzip', 'identity']
dougwilson
Jan 26, 2015
Member
Right. I'm not sure if the interface should make the user include identity
Right. I'm not sure if the interface should make the user include identity
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
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
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 :)
@hex7c0 , right, that is another case that needs to be fixed and why this PR hasn't been merged just yet :)
d7bb81b
to
cd957aa
closes #25