@@ -215,6 +215,7 @@ SSLNetVConnection::_bindSSLObject()
215215{
216216 SSLNetVCAttach (this ->ssl , this );
217217 TLSBasicSupport::bind (this ->ssl , this );
218+ ALPNSupport::bind (this ->ssl , this );
218219 TLSSessionResumptionSupport::bind (this ->ssl , this );
219220 TLSSNISupport::bind (this ->ssl , this );
220221}
@@ -224,6 +225,7 @@ SSLNetVConnection::_unbindSSLObject()
224225{
225226 SSLNetVCDetach (this ->ssl );
226227 TLSBasicSupport::unbind (this ->ssl );
228+ ALPNSupport::unbind (this ->ssl );
227229 TLSSessionResumptionSupport::unbind (this ->ssl );
228230 TLSSNISupport::unbind (this ->ssl );
229231}
@@ -1562,48 +1564,6 @@ SSLNetVConnection::sslClientHandShakeEvent(int &err)
15621564 return EVENT_CONT;
15631565}
15641566
1565- // NextProtocolNegotiation TLS extension callback. The NPN extension
1566- // allows the client to select a preferred protocol, so all we have
1567- // to do here is tell them what out protocol set is.
1568- int
1569- SSLNetVConnection::advertise_next_protocol (SSL *ssl, const unsigned char **out, unsigned int *outlen, void * /* arg ATS_UNUSED */ )
1570- {
1571- SSLNetVConnection *netvc = SSLNetVCAccess (ssl);
1572-
1573- ink_release_assert (netvc && netvc->ssl == ssl);
1574-
1575- if (netvc->getNPN (out, outlen)) {
1576- // Successful return tells OpenSSL to advertise.
1577- return SSL_TLSEXT_ERR_OK;
1578- }
1579- return SSL_TLSEXT_ERR_NOACK;
1580- }
1581-
1582- // ALPN TLS extension callback. Given the client's set of offered
1583- // protocols, we have to select a protocol to use for this session.
1584- int
1585- SSLNetVConnection::select_next_protocol (SSL *ssl, const unsigned char **out, unsigned char *outlen,
1586- const unsigned char *in ATS_UNUSED, unsigned inlen ATS_UNUSED, void *)
1587- {
1588- SSLNetVConnection *netvc = SSLNetVCAccess (ssl);
1589-
1590- ink_release_assert (netvc && netvc->ssl == ssl);
1591- const unsigned char *npnptr = nullptr ;
1592- unsigned int npnsize = 0 ;
1593- if (netvc->getNPN (&npnptr, &npnsize)) {
1594- // SSL_select_next_proto chooses the first server-offered protocol that appears in the clients protocol set, ie. the
1595- // server selects the protocol. This is a n^2 search, so it's preferable to keep the protocol set short.
1596- if (SSL_select_next_proto (const_cast <unsigned char **>(out), outlen, npnptr, npnsize, in, inlen) == OPENSSL_NPN_NEGOTIATED) {
1597- Debug (" ssl" , " selected ALPN protocol %.*s" , (int )(*outlen), *out);
1598- return SSL_TLSEXT_ERR_OK;
1599- }
1600- }
1601-
1602- *out = nullptr ;
1603- *outlen = 0 ;
1604- return SSL_TLSEXT_ERR_NOACK;
1605- }
1606-
16071567void
16081568SSLNetVConnection::reenable (NetHandler *nh, int event)
16091569{
0 commit comments