| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,27 +112,12 @@ MaybeLocal<Value> GetSSLOCSPResponse( | |||
| 112 | 112 | return ret; | |
| 113 | 113 | } | |
| 114 | 114 | ||
| 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 | - | ||
| 123 | 115 | bool SetTLSSession( | |
| 124 | 116 | const SSLPointer& ssl, | |
| 125 | 117 | const SSLSessionPointer& session) { | |
| 126 | 118 | return session != nullptr && SSL_set_session(ssl.get(), session.get()) == 1; | |
| 127 | 119 | } | |
| 128 | 120 | ||
| 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 | - | ||
| 136 | 121 | SSLSessionPointer GetTLSSession(const unsigned char* buf, size_t length) { | |
| 137 | 122 | return SSLSessionPointer(d2i_SSL_SESSION(nullptr, &buf, length)); | |
| 138 | 123 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,17 +42,10 @@ v8::MaybeLocal<v8::Value> GetSSLOCSPResponse( | |||
| 42 | 42 | SSL* ssl, | |
| 43 | 43 | v8::Local<v8::Value> default_value); | |
| 44 | 44 | ||
| 45 | - bool SetTLSSession( | ||
| 46 | - const SSLPointer& ssl, | ||
| 47 | - const unsigned char* buf, | ||
| 48 | - size_t length); | ||
| 49 | - | ||
| 50 | 45 | bool SetTLSSession( | |
| 51 | 46 | const SSLPointer& ssl, | |
| 52 | 47 | const SSLSessionPointer& session); | |
| 53 | 48 | ||
| 54 | - SSLSessionPointer GetTLSSession(v8::Local<v8::Value> val); | ||
| 55 | - | ||
| 56 | 49 | SSLSessionPointer GetTLSSession(const unsigned char* buf, size_t length); | |
| 57 | 50 | ||
| 58 | 51 | long 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) { | |||
| 1667 | 1667 | return THROW_ERR_MISSING_ARGS(env, "Session argument is mandatory"); | |
| 1668 | 1668 | ||
| 1669 | 1669 | 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()); | ||
| 1672 | 1672 | if (sess == nullptr) | |
| 1673 | - return; | ||
| 1673 | + return; // TODO(tniessen): figure out error handling | ||
| 1674 | 1674 | ||
| 1675 | 1675 | if (!SetTLSSession(w->ssl_, sess)) | |
| 1676 | 1676 | return env->ThrowError("SSL_set_session error"); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments