add some comments

This commit is contained in:
jiangfriend@gmail.com 2012-02-14 21:19:06 +08:00
parent 314d43203f
commit d1b7f36918
4 changed files with 17 additions and 13 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
raw
build
.lock-wscript

View file

@ -1,2 +1,3 @@
raw
build
.lock-wscript

View file

@ -14,7 +14,8 @@ curl(url, options, function(err, res) {
res.close();
});
curl('www.google.com', {VERBOSE: 1, RAW: 1}, function(err, res) {
curl('https://www.google.com', {VERBOSE: 1, RAW: 1}, function(err, res) {
console.info("\x1b[33meffetcive url: " + res.info('EFFECTIVE_URL') + "\x1b[0m");
console.info(res);
res.close();
});

View file

@ -14,8 +14,6 @@
#define NODE_CURL_OPTION(name) NODE_CURL_OPTION_NX(name , CURLOPT_##name)
#define NODE_CURL_EXPORT(name) export_curl_options(t, #name, name, sizeof(name) / sizeof(CurlOption));
class NodeCurl
{
struct CurlOption {
@ -37,6 +35,7 @@ class NodeCurl
: in_curlm(false)
{
++count;
// I know 2*4096 is magical world, but I have no idea the real memory curl will occupied
v8::V8::AdjustAmountOfExternalAllocatedMemory(2*4096);
object->SetPointerInInternalField(0, this);
handle = v8::Persistent<v8::Object>::New(object);
@ -329,6 +328,8 @@ class NodeCurl
if (msg->msg == CURLMSG_DONE)
{
NodeCurl * curl = curls[msg->easy_handle];
// ensure curl still exists,
// gc will delete the curl if there is no reference.
if (msg->data.result == CURLE_OK)
curl->on_end(msg);
else