-
Notifications
You must be signed in to change notification settings - Fork 0
/
test01.js
58 lines (50 loc) · 1.3 KB
/
test01.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var async = require('async');
/*var request = require('request');
var checkurl = function(host){
async.retry(5, function(callback) {
request.get({
url: 'http://' + host,
/!* headers: {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1941.3 Safari/537.36 (compatible; Allmobilize Spider/2.1; +http://www.yunshipei.com/bot.html)'
},
followAllRedirects: false,
followRedirect: false,
timeout: 5 * 1000,*!/
timeout: 5 * 1000,
encoding: false
}, function(err, response, body) {
// console.log(response.statusCode);
// console.log(i++);
if (err) {
return callback(new Error('网站无法打开'));
} else if (response.statusCode === 200) {
return callback();
} else if ((response.statusCode === 302) || (response.statusCode === 301)) {
return callback(null, response.headers.location);
} else {
return callback(new Error('网站无法打开'));
}
});
}, function(err, result) {
if (err){
console.log('cuode url')
}else{
console.log('duide url')
}
});
}
checkurl('14.17.105.78:80');
*/
var test = function(){
var flag=false;
outloop:for(var i=0;i< 10;i++){
console.log(i);
if(!flag){
break outloop;
}
}
async.times(1,function(){
},function(err,data){
});
}
test();