Skip to content

Commit be67fa7

Browse files
committed
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 6f8839d.
1 parent 8bd80f4 commit be67fa7

File tree

2 files changed

+12
-16
lines changed

2 files changed

+12
-16
lines changed

src/node_crypto.cc

+12-15
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ void SecureContext::Initialize(Handle<Object> target) {
166166
NODE_SET_PROTOTYPE_METHOD(t, "addRootCerts", SecureContext::AddRootCerts);
167167
NODE_SET_PROTOTYPE_METHOD(t, "setCiphers", SecureContext::SetCiphers);
168168
NODE_SET_PROTOTYPE_METHOD(t, "setOptions", SecureContext::SetOptions);
169-
NODE_SET_PROTOTYPE_METHOD(t, "clearOptions", SecureContext::ClearOptions);
170169
NODE_SET_PROTOTYPE_METHOD(t, "setSessionIdContext",
171170
SecureContext::SetSessionIdContext);
172171
NODE_SET_PROTOTYPE_METHOD(t, "close", SecureContext::Close);
@@ -541,23 +540,21 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
541540
return True();
542541
}
543542

544-
#define X(name, fn) \
545-
Handle<Value> name(const Arguments& args) { \
546-
HandleScope scope; \
547-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder()); \
548-
if (args.Length() != 1 || !args[0]->IsInt32()) { \
549-
return ThrowException( \
550-
Exception::TypeError(String::New("Bad parameter"))); \
551-
} \
552-
fn(sc->ctx_, args[0]->Int32Value()); \
553-
return True(); \
543+
Handle<Value> SecureContext::SetOptions(const Arguments& args) {
544+
HandleScope scope;
545+
546+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
547+
548+
if (args.Length() != 1 || !args[0]->IsUint32()) {
549+
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
554550
}
555551

556-
// can't use templates, SSL_CTX_set_options and SSL_CTX_clear_options are macros
557-
X(SecureContext::SetOptions, SSL_CTX_set_options)
558-
X(SecureContext::ClearOptions, SSL_CTX_clear_options)
552+
unsigned int opts = args[0]->Uint32Value();
553+
554+
SSL_CTX_set_options(sc->ctx_, opts);
559555

560-
#undef X
556+
return True();
557+
}
561558

562559
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
563560
HandleScope scope;

src/node_crypto.h

-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class SecureContext : ObjectWrap {
6666
static v8::Handle<v8::Value> AddRootCerts(const v8::Arguments& args);
6767
static v8::Handle<v8::Value> SetCiphers(const v8::Arguments& args);
6868
static v8::Handle<v8::Value> SetOptions(const v8::Arguments& args);
69-
static v8::Handle<v8::Value> ClearOptions(const v8::Arguments& args);
7069
static v8::Handle<v8::Value> SetSessionIdContext(const v8::Arguments& args);
7170
static v8::Handle<v8::Value> Close(const v8::Arguments& args);
7271

0 commit comments

Comments
 (0)