res.pipe(userRes,{end:false});

This commit is contained in:
想当当 2014-08-27 09:02:35 +08:00
parent 659a862341
commit 98599de892

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){