fixes #9 compatible with old version libcurl.

This commit is contained in:
Miao Jiang 2012-11-29 16:35:30 +08:00
parent 6f9d7e24fa
commit 9fe5666c9f

View file

@ -13,7 +13,7 @@
class NodeCurl class NodeCurl
{ {
struct CurlOption struct CurlOption
{ {
const char *name; const char *name;
int value; int value;
@ -204,7 +204,7 @@ class NodeCurl
return v8::Integer::New( return v8::Integer::New(
curl_easy_setopt( curl_easy_setopt(
curl, curl,
(CURLoption)option->Int32Value(), (CURLoption)option->Int32Value(),
value value
) )
); );
@ -322,7 +322,7 @@ class NodeCurl
return raise("curl_multi_remove_handle failed", curl_multi_strerror(code)); return raise("curl_multi_remove_handle failed", curl_multi_strerror(code));
} }
// ensure curl still exists, // ensure curl still exists,
// gc will delete the curl if there is no reference. // gc will delete the curl if there is no reference.
if (msg_copy.data.result == CURLE_OK) if (msg_copy.data.result == CURLE_OK)
curl->on_end(&msg_copy); curl->on_end(&msg_copy);
@ -389,7 +389,7 @@ class NodeCurl
NODE_SET_METHOD(t , "process_" , process); NODE_SET_METHOD(t , "process_" , process);
NODE_SET_METHOD(t , "get_count" , get_count); NODE_SET_METHOD(t , "get_count" , get_count);
// Set curl constants // Set curl constants
#include "string_options.h" #include "string_options.h"
#include "integer_options.h" #include "integer_options.h"
#include "string_infos.h" #include "string_infos.h"
@ -398,13 +398,22 @@ class NodeCurl
#define X(name) {#name, CURLOPT_##name} #define X(name) {#name, CURLOPT_##name}
CurlOption slist_options[] = { CurlOption slist_options[] = {
#if LIBCURL_VERSION_NUM >= 0x070a03
X(HTTP200ALIASES),
#endif
#if LIBCURL_VERSION_NUM >= 0x071400
X(MAIL_RCPT),
#endif
#if LIBCURL_VERSION_NUM >= 0x071503
X(RESOLVE),
#endif
X(HTTPHEADER), X(HTTPHEADER),
X(HTTP200ALIASES),
X(MAIL_RCPT),
X(QUOTE), X(QUOTE),
X(POSTQUOTE), X(POSTQUOTE),
X(PREQUOTE), X(PREQUOTE),
X(RESOLVE),
X(TELNETOPTIONS) X(TELNETOPTIONS)
}; };
#undef X #undef X