Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'content-encoding': false
};
if (util.matchHeaders(request.headers, { 'accept-encoding': /xz/ }) &&
util.matchHeaders(source.headers, headerMatch)) {
metrics.count('hit');
// We are writing xz content
source.headers['content-encoding'] = 'xz';
// We do not know the length
delete source.headers['content-length'];
dest.writeHead(source.statusCode, source.headers);
source.pipe(lzma.createStream('easyEncoder',
{ preset: CONFIG.xz.level })).pipe(dest);
} else {
// Do nothing
metrics.count('miss');
source.forward(dest);
}
source.resume();
};