Merge pull request #4 from alexyan/master

res.pipe(userRes,{end:false});
This commit is contained in:
想当当 2014-08-27 09:03:35 +08:00
commit d10dcd24d7

View File

@ -114,17 +114,13 @@ function userRequestHandler(req,userRes){
var proxyReq = (ifHttps ? https : http).request(options, function(res) {
userRes.writeHead(res.statusCode,mergeCORSHeader(req.headers,res.headers));
if(callback){
res.on('data',function(chunk){
userRes.write(chunk);
});
res.on('end',function(){
callback(userRes);
userRes.end();
});
}else{
res.pipe(userRes);
}
res.pipe(userRes,{end:false});
res.on('end',function(){
if(callback)callback(userRes);
userRes.end();
});
});
proxyReq.on("error",function(e){