File tree Expand file tree Collapse file tree 3 files changed +4
-12
lines changed Open diff view settings
Expand file tree Collapse file tree 3 files changed +4
-12
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -89,12 +89,6 @@ void LogSecret(
8989 keylog_cb (ssl.get (), line.c_str ());
9090}
9191
92- bool SetALPN (const SSLPointer& ssl, std::string_view alpn) {
93- return SSL_set_alpn_protos (ssl.get (),
94- reinterpret_cast <const uint8_t *>(alpn.data ()),
95- alpn.length ()) == 0 ;
96- }
97-
9892MaybeLocal<Value> GetSSLOCSPResponse (
9993 Environment* env,
10094 SSL* ssl,
Original file line number Diff line number Diff line change @@ -33,9 +33,6 @@ void LogSecret(
3333 const unsigned char * secret,
3434 size_t secretlen);
3535
36- // TODO(tniessen): use std::u8string_view when we switch to C++20.
37- bool SetALPN (const SSLPointer& ssl, std::string_view alpn);
38-
3936v8::MaybeLocal<v8::Value> GetSSLOCSPResponse (
4037 Environment* env,
4138 SSL* ssl,
Original file line number Diff line number Diff line change @@ -1529,17 +1529,18 @@ void TLSWrap::SetALPNProtocols(const FunctionCallbackInfo<Value>& args) {
15291529 if (args.Length () < 1 || !Buffer::HasInstance (args[0 ]))
15301530 return env->ThrowTypeError (" Must give a Buffer as first argument" );
15311531
1532+ SSL* ssl = w->ssl_ .get ();
15321533 if (w->is_client ()) {
1533- ArrayBufferViewContents<char > protos (args[0 ].As <ArrayBufferView>());
1534- CHECK ( SetALPN (w-> ssl_ , { protos.data (), protos.length ()} ));
1534+ ArrayBufferViewContents<uint8_t > protos (args[0 ].As <ArrayBufferView>());
1535+ CHECK_EQ ( 0 , SSL_set_alpn_protos (ssl, protos.data (), protos.length ()));
15351536 } else {
15361537 CHECK (
15371538 w->object ()->SetPrivate (
15381539 env->context (),
15391540 env->alpn_buffer_private_symbol (),
15401541 args[0 ]).FromJust ());
15411542 // Server should select ALPN protocol from list of advertised by client
1542- SSL_CTX_set_alpn_select_cb (SSL_get_SSL_CTX (w-> ssl_ . get () ),
1543+ SSL_CTX_set_alpn_select_cb (SSL_get_SSL_CTX (ssl ),
15431544 SelectALPNCallback,
15441545 nullptr );
15451546 }
You can’t perform that action at this time.
0 commit comments