comptible with node-curl v0.1.3
This commit is contained in:
parent
34c42b0ebd
commit
e941a326d9
1 changed files with 16 additions and 21 deletions
|
@ -1,28 +1,23 @@
|
||||||
curl = require('../index');
|
Curl = require('../index');
|
||||||
|
options = {CONNECTTIMEOUT: 2};
|
||||||
|
curl = Curl.create(options)
|
||||||
url = 'www.nodejs.org';
|
url = 'www.nodejs.org';
|
||||||
options = {CONNECTTIMEOUT: 2, VERBOSE: 1};
|
curl(url, function(err) {
|
||||||
curl(url, options, function(err, res) {
|
console.info("\x1b[33meffetcive url: " + this.info('EFFECTIVE_URL') + "\x1b[0m");
|
||||||
console.info("\x1b[33meffetcive url: " + res.info('EFFECTIVE_URL') + "\x1b[0m");
|
console.info("body length: " + this.body.length);
|
||||||
console.info("body length: " + res.body.length);
|
this.close()
|
||||||
res.close();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
curl = Curl.create(options)
|
||||||
url = 'www.yahoo.com'
|
url = 'www.yahoo.com'
|
||||||
curl(url, options, function(err, res) {
|
curl(url, function(err) {
|
||||||
console.info("\x1b[33meffetcive url: " + res.info('EFFECTIVE_URL') + "\x1b[0m");
|
console.info("\x1b[33meffetcive url: " + this.info('EFFECTIVE_URL') + "\x1b[0m");
|
||||||
console.info("body length: " + res.body.length);
|
console.info("body length: " + this.body.length);
|
||||||
res.close();
|
this.close()
|
||||||
});
|
});
|
||||||
|
|
||||||
curl('https://www.google.com', {VERBOSE: 1, RAW: 1}, function(err, res) {
|
curl = Curl.create(options)
|
||||||
console.info("\x1b[33meffetcive url: " + res.info('EFFECTIVE_URL') + "\x1b[0m");
|
curl('https://www.google.com', {VERBOSE: 1, RAW: 1}, function(err) {
|
||||||
console.info(res);
|
console.info("\x1b[33meffetcive url: " + this.info('EFFECTIVE_URL') + "\x1b[0m");
|
||||||
res.close();
|
this.close()
|
||||||
});
|
});
|
||||||
|
|
||||||
/*
|
|
||||||
console.info('-----');
|
|
||||||
console.info("status: " + res.status);
|
|
||||||
console.info('-----');
|
|
||||||
console.info("size download: " + res.info('SIZE_DOWNLOAD'));
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue