File tree Expand file tree Collapse file tree 3 files changed +3
-25
lines changed Expand file tree Collapse file tree 3 files changed +3
-25
lines changed Original file line number Diff line number Diff line change @@ -112,27 +112,12 @@ MaybeLocal<Value> GetSSLOCSPResponse(
112112 return ret;
113113}
114114
115- bool SetTLSSession (
116- const SSLPointer& ssl,
117- const unsigned char * buf,
118- size_t length) {
119- SSLSessionPointer s (d2i_SSL_SESSION (nullptr , &buf, length));
120- return s == nullptr ? false : SetTLSSession (ssl, s);
121- }
122-
123115bool SetTLSSession (
124116 const SSLPointer& ssl,
125117 const SSLSessionPointer& session) {
126118 return session != nullptr && SSL_set_session (ssl.get (), session.get ()) == 1 ;
127119}
128120
129- SSLSessionPointer GetTLSSession (Local<Value> val) {
130- if (!val->IsArrayBufferView ())
131- return SSLSessionPointer ();
132- ArrayBufferViewContents<unsigned char > sbuf (val.As <ArrayBufferView>());
133- return GetTLSSession (sbuf.data (), sbuf.length ());
134- }
135-
136121SSLSessionPointer GetTLSSession (const unsigned char * buf, size_t length) {
137122 return SSLSessionPointer (d2i_SSL_SESSION (nullptr , &buf, length));
138123}
Original file line number Diff line number Diff line change @@ -42,17 +42,10 @@ v8::MaybeLocal<v8::Value> GetSSLOCSPResponse(
4242 SSL* ssl,
4343 v8::Local<v8::Value> default_value);
4444
45- bool SetTLSSession (
46- const SSLPointer& ssl,
47- const unsigned char * buf,
48- size_t length);
49-
5045bool SetTLSSession (
5146 const SSLPointer& ssl,
5247 const SSLSessionPointer& session);
5348
54- SSLSessionPointer GetTLSSession (v8::Local<v8::Value> val);
55-
5649SSLSessionPointer GetTLSSession (const unsigned char * buf, size_t length);
5750
5851long VerifyPeerCertificate ( // NOLINT(runtime/int)
Original file line number Diff line number Diff line change @@ -1667,10 +1667,10 @@ void TLSWrap::SetSession(const FunctionCallbackInfo<Value>& args) {
16671667 return THROW_ERR_MISSING_ARGS (env, " Session argument is mandatory" );
16681668
16691669 THROW_AND_RETURN_IF_NOT_BUFFER (env, args[0 ], " Session" );
1670-
1671- SSLSessionPointer sess = GetTLSSession (args[ 0 ] );
1670+ ArrayBufferViewContents< unsigned char > sbuf (args[ 0 ]);
1671+ SSLSessionPointer sess = GetTLSSession (sbuf. data (), sbuf. length () );
16721672 if (sess == nullptr )
1673- return ;
1673+ return ; // TODO(tniessen): figure out error handling
16741674
16751675 if (!SetTLSSession (w->ssl_ , sess))
16761676 return env->ThrowError (" SSL_set_session error" );
You can’t perform that action at this time.
0 commit comments