bugfix for https throttle

This commit is contained in:
OttoMao 2015-01-12 10:43:20 +08:00
parent c5ffd57e71
commit d5b6958dd9
2 changed files with 14 additions and 6 deletions

View File

@ -295,14 +295,22 @@ function connectReqHandler(req, socket, head){
callback(); callback();
} }
//connect //connect
},function(callback){ },function(callback){
try{ try{
var conn = net.connect(proxyPort, proxyHost, function(){ var conn = net.connect(proxyPort, proxyHost, function(){
socket.write('HTTP/' + req.httpVersion + ' 200 OK\r\n\r\n', 'UTF-8', function() { socket.write('HTTP/' + req.httpVersion + ' 200 OK\r\n\r\n', 'UTF-8', function(){
//throttle for direct-foward https
if(GLOBAL._throttle && !shouldIntercept ){
var readable = conn.pipe(GLOBAL._throttle.throttle());
readable.pipe(socket);
socket.pipe(conn);
}else{
conn.pipe(socket); conn.pipe(socket);
socket.pipe(conn); socket.pipe(conn);
}
callback(); callback();
}); });

View File

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