diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-01-02 12:29:39 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-01-02 12:29:39 +0100 |
commit | c123ac05dc37311d3dfb37ed6f22baef58280379 (patch) | |
tree | f1c49f60d3affab2148d50af7df46c0fe2238c4d /src/node_crypto.cc | |
parent | 4b3824b6826db3487d7490283d3d7f396720f337 (diff) | |
parent | 6f8839d2ac362ced42235a34a023af5e2c656501 (diff) | |
download | node-c123ac05dc37311d3dfb37ed6f22baef58280379.tar.gz |
Merge remote-tracking branch 'origin/v0.6'
Conflicts:
src/udp_wrap.cc
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r-- | src/node_crypto.cc | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index bcd3949ec..5f58240e0 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -151,6 +151,7 @@ void SecureContext::Initialize(Handle<Object> target) { NODE_SET_PROTOTYPE_METHOD(t, "addRootCerts", SecureContext::AddRootCerts); NODE_SET_PROTOTYPE_METHOD(t, "setCiphers", SecureContext::SetCiphers); NODE_SET_PROTOTYPE_METHOD(t, "setOptions", SecureContext::SetOptions); + NODE_SET_PROTOTYPE_METHOD(t, "clearOptions", SecureContext::ClearOptions); NODE_SET_PROTOTYPE_METHOD(t, "setSessionIdContext", SecureContext::SetSessionIdContext); NODE_SET_PROTOTYPE_METHOD(t, "close", SecureContext::Close); @@ -525,21 +526,23 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) { return True(); } -Handle<Value> SecureContext::SetOptions(const Arguments& args) { - HandleScope scope; - - SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder()); - - if (args.Length() != 1 || !args[0]->IsUint32()) { - return ThrowException(Exception::TypeError(String::New("Bad parameter"))); +#define X(name, fn) \ + Handle<Value> name(const Arguments& args) { \ + HandleScope scope; \ + SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder()); \ + if (args.Length() != 1 || !args[0]->IsInt32()) { \ + return ThrowException( \ + Exception::TypeError(String::New("Bad parameter"))); \ + } \ + fn(sc->ctx_, args[0]->Int32Value()); \ + return True(); \ } - unsigned int opts = args[0]->Uint32Value(); - - SSL_CTX_set_options(sc->ctx_, opts); +// can't use templates, SSL_CTX_set_options and SSL_CTX_clear_options are macros +X(SecureContext::SetOptions, SSL_CTX_set_options) +X(SecureContext::ClearOptions, SSL_CTX_clear_options) - return True(); -} +#undef X Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) { HandleScope scope; |