fixes #2 CookieList returning same data for each cookie

new structure for node-curl
This commit is contained in:
jiangfriend@gmail.com 2012-05-28 19:55:17 +08:00
parent e791a14c6e
commit 90f3135c8c
11 changed files with 461 additions and 237 deletions

View file

@ -9,22 +9,20 @@ Quick Start
* quick start
curl = require('node-curl');
curl('www.google.com', function(err, res) {
console.info(res.status);
curl('www.google.com', function(err) {
console.info(this.status);
console.info('-----');
console.info(res.body);
console.info(this.body);
console.info('-----');
console.info(res.info('SIZE_DOWNLOAD'));
res.close();
console.info(this.info('SIZE_DOWNLOAD'));
});
* with options
curl = require('node-curl')
curl('www.google.com', {VERBOSE: 1, RAW: 1}, function(err, res) {
console.info(res);
res.close();
curl('www.google.com', {VERBOSE: 1, RAW: 1}, function(err) {
console.info(this);
});
Usage
@ -33,9 +31,10 @@ Usage
* curl
curl(url, [options = {}], callback)
callback includes 2 parameters (error, result)
callback includes 1 parameters (error)
result is stored in curl
* result in callback
* Retrieve Data from curl
members:
status - Http Response code
@ -44,23 +43,34 @@ Usage
methods:
info(name) - Get information of result, see 'info' section
* Curl Control
methods:
void reset()
- reset curl and set options to default options
void setDefaultOptions(options, reset = true)
- set default options
curl create(defaultOptions)
- create a new curl with default options
Options
-------
* Any Curl Easy Options
* Any cURL Easy Options
eg: CURLOPT_VERBOSE will be VERBOSE, CURLOPT_HEADER will be HEADER
Full list at http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
Full list at http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
* node-curl Extra Options
RAW - Returns Buffer instead of String in result.body
RAW - Returns Buffer instead of String in result.body
* About slist parameters
node-curl support slist which map to Javascript Array
eg:
eg:
HTTP_HEADER: ['FOO', 'BAR']
HTTP_HEADER: 'FOO'
@ -68,7 +78,7 @@ Options
Infos
-----
* Any Curl Info options
* Any cURL Info options
eg: CURLINFO_EFFECTIVE_URL will be EFFETCTIVE_URL
@ -80,9 +90,6 @@ Infos
slist will be returns in Array
eg: CURLINFO_COOKIELIST
Hints
-----
close the result to release resource of curl immediately.
or the resource will not release until gc performed.