summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2012-01-06 12:00:36 -0800
committerRyan Dahl <ry@tinyclouds.org>2012-01-06 12:01:58 -0800
commitbe67fa7e095d47806983e126ef45639c7d9a2867 (patch)
tree891c47765e1b9e00eccaa11918fffc8d98d02081
parent8bd80f49117d6a772584a8d93dface0fb31ad931 (diff)
downloadnode-be67fa7e095d47806983e126ef45639c7d9a2867.tar.gz
Revert "crypto: add SecureContext.clearOptions() method"
API addition needs to go in master. Also openssl-0.9.8k doesn't have SSL_CTX_clear_options(). This reverts commit 6f8839d2ac362ced42235a34a023af5e2c656501.
-rw-r--r--src/node_crypto.cc27
-rw-r--r--src/node_crypto.h1
2 files changed, 12 insertions, 16 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index f3bff2ed0..9f73df35c 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -166,7 +166,6 @@ 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);
@@ -541,23 +540,21 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
return True();
}
-#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(); \
+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")));
}
-// 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)
+ unsigned int opts = args[0]->Uint32Value();
+
+ SSL_CTX_set_options(sc->ctx_, opts);
-#undef X
+ return True();
+}
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
HandleScope scope;
diff --git a/src/node_crypto.h b/src/node_crypto.h
index 58168e3df..4cde964da 100644
--- a/src/node_crypto.h
+++ b/src/node_crypto.h
@@ -66,7 +66,6 @@ class SecureContext : ObjectWrap {
static v8::Handle<v8::Value> AddRootCerts(const v8::Arguments& args);
static v8::Handle<v8::Value> SetCiphers(const v8::Arguments& args);
static v8::Handle<v8::Value> SetOptions(const v8::Arguments& args);
- static v8::Handle<v8::Value> ClearOptions(const v8::Arguments& args);
static v8::Handle<v8::Value> SetSessionIdContext(const v8::Arguments& args);
static v8::Handle<v8::Value> Close(const v8::Arguments& args);