@ -166,6 +166,7 @@ void SecureContext::Initialize(Handle<Object> target) {
NODE_SET_PROTOTYPE_METHOD ( t , " addRootCerts " , SecureContext : : AddRootCerts ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " addRootCerts " , SecureContext : : AddRootCerts ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " setCiphers " , SecureContext : : SetCiphers ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " setCiphers " , SecureContext : : SetCiphers ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " setOptions " , SecureContext : : SetOptions ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " setOptions " , SecureContext : : SetOptions ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " clearOptions " , SecureContext : : ClearOptions ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " setSessionIdContext " ,
NODE_SET_PROTOTYPE_METHOD ( t , " setSessionIdContext " ,
SecureContext : : SetSessionIdContext ) ;
SecureContext : : SetSessionIdContext ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " close " , SecureContext : : Close ) ;
NODE_SET_PROTOTYPE_METHOD ( t , " close " , SecureContext : : Close ) ;
@ -540,21 +541,23 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
return True ( ) ;
return True ( ) ;
}
}
Handle < Value > SecureContext : : SetOptions ( const Arguments & args ) {
# define X(name, fn) \
HandleScope scope ;
Handle < Value > name ( const Arguments & args ) { \
HandleScope scope ; \
SecureContext * sc = ObjectWrap : : Unwrap < SecureContext > ( args . Holder ( ) ) ;
SecureContext * sc = ObjectWrap : : Unwrap < SecureContext > ( args . Holder ( ) ) ; \
if ( args . Length ( ) ! = 1 | | ! args [ 0 ] - > IsInt32 ( ) ) { \
if ( args . Length ( ) ! = 1 | | ! args [ 0 ] - > IsUint32 ( ) ) {
return ThrowException ( \
return ThrowException ( Exception : : TypeError ( String : : New ( " Bad parameter " ) ) ) ;
Exception : : TypeError ( String : : New ( " Bad parameter " ) ) ) ; \
} \
fn ( sc - > ctx_ , args [ 0 ] - > Int32Value ( ) ) ; \
return True ( ) ; \
}
}
unsigned int opts = args [ 0 ] - > Uint32Value ( ) ;
// can't use templates, SSL_CTX_set_options and SSL_CTX_clear_options are macros
X ( SecureContext : : SetOptions , SSL_CTX_set_options )
SSL_CTX_set_options ( sc - > ctx_ , opts ) ;
X ( SecureContext : : ClearOptions , SSL_CTX_clear_options )
return True ( ) ;
# undef X
}
Handle < Value > SecureContext : : SetSessionIdContext ( const Arguments & args ) {
Handle < Value > SecureContext : : SetSessionIdContext ( const Arguments & args ) {
HandleScope scope ;
HandleScope scope ;