crypto: use SSL_SESSION_get_id
This accessor exists in OpenSSL 1.0.2, so it may be used already. This is cherry-picked from PR #8491. PR-URL: https://github.com/nodejs/node/pull/15348 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
03954f778e
commit
c51e0e97cc
@ -1424,10 +1424,13 @@ int SSLWrap<Base>::NewSessionCallback(SSL* s, SSL_SESSION* sess) {
|
||||
memset(serialized, 0, size);
|
||||
i2d_SSL_SESSION(sess, &serialized);
|
||||
|
||||
unsigned int session_id_length;
|
||||
const unsigned char* session_id = SSL_SESSION_get_id(sess,
|
||||
&session_id_length);
|
||||
Local<Object> session = Buffer::Copy(
|
||||
env,
|
||||
reinterpret_cast<char*>(sess->session_id),
|
||||
sess->session_id_length).ToLocalChecked();
|
||||
reinterpret_cast<const char*>(session_id),
|
||||
session_id_length).ToLocalChecked();
|
||||
Local<Value> argv[] = { session, buff };
|
||||
w->new_session_wait_ = true;
|
||||
w->MakeCallback(env->onnewsession_string(), arraysize(argv), argv);
|
||||
|
Loading…
x
Reference in New Issue
Block a user