Permalink
Browse files

Update README

  • Loading branch information...
1 parent 91f39f4 commit 648e170fa83ac02c39554d716416c479e7d9ac38 @jiangmiao committed Feb 19, 2013
Showing with 5 additions and 2 deletions.
  1. +3 −1 README.md
  2. +2 −1 examples/low-level.js
View
@@ -144,15 +144,17 @@ Example: examples/low-level.js
return chunk.length;
});
+ // curl.close() should be called in event 'error' and 'end' if the curl won't use any more.
+ // or the resource will not release until V8 garbage mark sweep.
curl.on('error', function(e) {
p("error: " + e.message)
curl.close();
});
curl.on('end', function() {
- p('done.')
p('code: ' + curl.getinfo('RESPONSE_CODE'));
+ p('done.')
curl.close();
});
View
@@ -10,6 +10,7 @@ if (!url)
curl.setopt('URL', url);
curl.setopt('CONNECTTIMEOUT', 2);
+curl.setopt('VERBOSE', 1);
// on 'data' must be returns chunk.length, or means interrupt the transfer
curl.on('data', function(chunk) {
@@ -25,7 +26,7 @@ curl.on('error', function(e) {
curl.on('end', function() {
- curl.getinfo('RESPONSE_CODE');
+ p("code: " + curl.getinfo('RESPONSE_CODE'));
curl.close();
p('done.');
});

0 comments on commit 648e170

Please sign in to comment.