Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function proxycheck() {
- pl1 && pl1.forEach(function(v,i,a){
- /* proxy test */
- var p1=v.split(":");
- var options = {method: 'GET', 'path': 'http://imgur.com/stats', headers: {'Host': 'imgur.com' }};
- options.host=p1[0];
- options.port=p1[1];
- var req = http.request(options, function(response) {
- var bytes1=0;
- response.on('data', function(chunk) {bytes1+= chunk.length;});
- response.on('end', function() {
- console.log(response.statusCode,bytes1,req.proxy,response.statusCode==200&&bytes1==26777);
- if (response.statusCode==200&&bytes1>25000) {
- pl.push(req.proxy);
- }
- else {
- var i=pl1.indexOf(req.proxy);
- i&pl1.splice(i,1);
- }
- })
- });
- req.proxy=v;
- req.on('error', function(e) {console.log("# ERROR\t",req.proxy,e)});
- req.setTimeout(30000,function(){req.abort()});
- req.write('');
- req.end();
- /* */
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement