fix a bug about deflate compression

This commit is contained in:
OttoMao 2015-07-28 21:53:42 +08:00
parent 50e8fb4878
commit 6975138c96
3 changed files with 12 additions and 2 deletions

View File

@ -1,3 +1,7 @@
28 July: AnyProxy 3.7.1:
* fix a bug about deflate compression
20 July: AnyProxy 3.7.0:
* add a map-local panel on web ui, now you can easily map some request to your local files

View File

@ -121,6 +121,9 @@ function userRequestHandler(req,userRes){
options = userRule.replaceRequestOption(req,options) || options;
options.rejectUnauthorized = false;
try{
delete options.headers['accept-encoding']; //avoid gzipped response
}catch(e){}
//update quest data
reqData = userRule.replaceRequestData(req,reqData) || reqData;
@ -138,8 +141,11 @@ function userRequestHandler(req,userRes){
resHeader = util.lower_keys(resHeader);
// remove gzip related header, and ungzip the content
// note there are other compression types like deflate
var ifServerGzipped = /gzip/i.test(resHeader['content-encoding']);
delete resHeader['content-encoding'];
if(ifServerGzipped){
delete resHeader['content-encoding'];
}
delete resHeader['content-length'];
userRes.writeHead(statusCode, resHeader);

View File

@ -1,6 +1,6 @@
{
"name": "anyproxy",
"version": "3.7.0",
"version": "3.7.1",
"description": "A fully configurable proxy in NodeJS, which can handle HTTPS requests perfectly.",
"main": "proxy.js",
"bin": {