[trafficserver] branch master updated (521b279 -> ba23fe2)

2021-03-09 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from 521b279  Build the test library for tls_engine consistently (#7588)
 add ba23fe2  Change the default value for verify.server.policy (#7587)

No new revisions were added by this update.

Summary of changes:
 doc/admin-guide/files/records.config.en.rst   | 2 +-
 mgmt/RecordsConfig.cc | 2 +-
 tests/gold_tests/tls/tls_verify_base.test.py  | 3 ++-
 tests/gold_tests/tls/tls_verify_override_base.test.py | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)



[trafficserver] branch master updated (cb247c6 -> 521b279)

2021-03-09 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git.


from cb247c6  Generalize ALPN logic (#7555)
 add 521b279  Build the test library for tls_engine consistently (#7588)

No new revisions were added by this update.

Summary of changes:
 tests/gold_tests/tls/tls_engine.test.py |   3 +-
 tests/tools/plugins/Makefile.inc|   4 +
 tests/tools/plugins/async_engine.c  | 312 
 3 files changed, 317 insertions(+), 2 deletions(-)
 create mode 100644 tests/tools/plugins/async_engine.c



[trafficserver] branch 9.0.x updated: Updated ChangeLog

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 67fc235  Updated ChangeLog
67fc235 is described below

commit 67fc235dd003fd324d8ca1e3b4f64cef2777af05
Author: Leif Hedstrom 
AuthorDate: Tue Mar 9 10:13:43 2021 -0700

Updated ChangeLog
---
 CHANGELOG-9.0.1 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/CHANGELOG-9.0.1 b/CHANGELOG-9.0.1
index d1cb2f9..f246972 100644
--- a/CHANGELOG-9.0.1
+++ b/CHANGELOG-9.0.1
@@ -39,8 +39,10 @@ Changes with Apache Traffic Server 9.0.1
   #7495 - Add zlib1g-dev to Debian dependencies in README
   #7506 - Fixed build issues with Fedora 34
   #7507 - Fixing DNS local_ipv* config option
+  #7515 - Replace psutil.pid() with psutil.process_iter() for safer execution
   #7526 - Fix out of bounds access error in jtest
   #7534 - Updating to use Proxy Verifier 2.1.0
   #7549 - Release Notes update on HTTP/2 disabling in v9.x
   #7551 - Removes the test plugins from the .spec file / RPM
   #7558 - Fix parent.config timeouts to return a 504 not 502 on timeout
+  #7564 - Fix compress issues with 304s, only looks at 304 headers



[trafficserver] branch 9.0.x updated: replace psutil.pid() with psutil.process_iter() for safer execution (#7515)

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 0214e59  replace psutil.pid() with psutil.process_iter() for safer 
execution (#7515)
0214e59 is described below

commit 0214e599250605cc3f62ff8fe2408c947df7fd7f
Author: Fei Deng 
AuthorDate: Wed Feb 10 21:14:31 2021 -0600

replace psutil.pid() with psutil.process_iter() for safer execution (#7515)

(cherry picked from commit 6abea9063bfb0fa0b2d398bcf41d341f2e09f694)
---
 tests/gold_tests/thread_config/check_threads.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/gold_tests/thread_config/check_threads.py 
b/tests/gold_tests/thread_config/check_threads.py
index 7cc46c9..6cc5801 100755
--- a/tests/gold_tests/thread_config/check_threads.py
+++ b/tests/gold_tests/thread_config/check_threads.py
@@ -23,12 +23,11 @@ import sys
 
 def count_threads(ts_path, etnet_threads, accept_threads):
 
-for pid in psutil.pids():
+for p in psutil.process_iter(['name', 'cwd', 'threads']):
 
 # Find the pid corresponding to the ats process we started in autest.
 # It needs to match the process name and the binary path.
 # If autest can expose the pid of the process this is not needed 
anymore.
-p = psutil.Process(pid)
 if p.name() == '[TS_MAIN]' and p.cwd() == ts_path:
 
 etnet_check = set()



[trafficserver] branch 9.1.x updated: replace psutil.pid() with psutil.process_iter() for safer execution (#7515)

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
 new 818d7d1  replace psutil.pid() with psutil.process_iter() for safer 
execution (#7515)
818d7d1 is described below

commit 818d7d152316b00c65ee716b320a1a59059389f7
Author: Fei Deng 
AuthorDate: Wed Feb 10 21:14:31 2021 -0600

replace psutil.pid() with psutil.process_iter() for safer execution (#7515)

(cherry picked from commit 6abea9063bfb0fa0b2d398bcf41d341f2e09f694)
---
 tests/gold_tests/thread_config/check_threads.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tests/gold_tests/thread_config/check_threads.py 
b/tests/gold_tests/thread_config/check_threads.py
index 7cc46c9..6cc5801 100755
--- a/tests/gold_tests/thread_config/check_threads.py
+++ b/tests/gold_tests/thread_config/check_threads.py
@@ -23,12 +23,11 @@ import sys
 
 def count_threads(ts_path, etnet_threads, accept_threads):
 
-for pid in psutil.pids():
+for p in psutil.process_iter(['name', 'cwd', 'threads']):
 
 # Find the pid corresponding to the ats process we started in autest.
 # It needs to match the process name and the binary path.
 # If autest can expose the pid of the process this is not needed 
anymore.
-p = psutil.Process(pid)
 if p.name() == '[TS_MAIN]' and p.cwd() == ts_path:
 
 etnet_check = set()



[trafficserver] branch 9.1.x updated: Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (#7564)

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
 new 087f9cc  Add a check for compress response, if from server and 304, 
then check cache for headers instead of the 304 response (#7564)
087f9cc is described below

commit 087f9cc4fe1733763708b9d1aebc1e4d260e48ca
Author: Evan Zelkowitz 
AuthorDate: Thu Mar 4 14:33:12 2021 -0800

Add a check for compress response, if from server and 304, then check cache 
for headers instead of the 304 response (#7564)

(cherry picked from commit b1a5cbd8e46b3dbffa7fb73bf6c100b84cbee239)
---
 plugins/compress/compress.cc | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/plugins/compress/compress.cc b/plugins/compress/compress.cc
index f0b1d8a..13e5f97 100644
--- a/plugins/compress/compress.cc
+++ b/plugins/compress/compress.cc
@@ -657,6 +657,16 @@ transformable(TSHttpTxn txnp, bool server, 
HostConfiguration *host_configuration
 return 0;
   }
 
+  // We got a server response but it was a 304
+  // we need to update our data to come from cache instead of
+  // the 304 response which does not need to include all headers
+  if ((server) && (resp_status == TS_HTTP_STATUS_NOT_MODIFIED)) {
+TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
+if (TS_SUCCESS != TSHttpTxnCachedRespGet(txnp, , _loc)) {
+  return 0;
+}
+  }
+
   if (TS_SUCCESS != TSHttpTxnClientReqGet(txnp, , )) {
 info("cound not get client request");
 TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);



[trafficserver] branch 9.0.x updated: Add a check for compress response, if from server and 304, then check cache for headers instead of the 304 response (#7564)

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new fd7dda0  Add a check for compress response, if from server and 304, 
then check cache for headers instead of the 304 response (#7564)
fd7dda0 is described below

commit fd7dda07429dcaca512f38741569a42683e71a97
Author: Evan Zelkowitz 
AuthorDate: Thu Mar 4 14:33:12 2021 -0800

Add a check for compress response, if from server and 304, then check cache 
for headers instead of the 304 response (#7564)

(cherry picked from commit b1a5cbd8e46b3dbffa7fb73bf6c100b84cbee239)
---
 plugins/compress/compress.cc | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/plugins/compress/compress.cc b/plugins/compress/compress.cc
index f0b1d8a..13e5f97 100644
--- a/plugins/compress/compress.cc
+++ b/plugins/compress/compress.cc
@@ -657,6 +657,16 @@ transformable(TSHttpTxn txnp, bool server, 
HostConfiguration *host_configuration
 return 0;
   }
 
+  // We got a server response but it was a 304
+  // we need to update our data to come from cache instead of
+  // the 304 response which does not need to include all headers
+  if ((server) && (resp_status == TS_HTTP_STATUS_NOT_MODIFIED)) {
+TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);
+if (TS_SUCCESS != TSHttpTxnCachedRespGet(txnp, , _loc)) {
+  return 0;
+}
+  }
+
   if (TS_SUCCESS != TSHttpTxnClientReqGet(txnp, , )) {
 info("cound not get client request");
 TSHandleMLocRelease(bufp, TS_NULL_MLOC, hdr_loc);



[trafficserver] branch 9.0.x updated: Updated ChangeLog

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new cfd5d35  Updated ChangeLog
cfd5d35 is described below

commit cfd5d351e44884426ef894a7e1eeb299df569338
Author: Leif Hedstrom 
AuthorDate: Tue Mar 9 10:08:07 2021 -0700

Updated ChangeLog
---
 CHANGELOG-9.0.1 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/CHANGELOG-9.0.1 b/CHANGELOG-9.0.1
index b891888..d1cb2f9 100644
--- a/CHANGELOG-9.0.1
+++ b/CHANGELOG-9.0.1
@@ -15,7 +15,6 @@ Changes with Apache Traffic Server 9.0.1
   #7309 - Disable client inactivity timeout while server is processing POST 
request
   #7347 - Allow for regex_remap of pristine URL.
   #7377 - Addresses some of the lock contention with HostStatus.
-  #7389 - Apple Silicon macOS support
   #7395 - Replace ::exit() with _exit() to avoid secondary cleanup cores
   #7410 - Fix issue with unavailable server retry codes
   #7414 - Remove the warning messages



[trafficserver] branch 9.1.x updated: Revert "Disable compiling Inline.cc on macOS (#7389)"

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.1.x by this push:
 new 5e2ee40  Revert "Disable compiling Inline.cc on macOS (#7389)"
5e2ee40 is described below

commit 5e2ee40d8ad52369b4c7645527a0e3fe0cd70d8f
Author: Leif Hedstrom 
AuthorDate: Tue Mar 9 10:04:20 2021 -0700

Revert "Disable compiling Inline.cc on macOS (#7389)"

This reverts commit bc41ebdf6fbcb941ab904608ffcaf4b126f10e3b.

This breaks builds on other (Intel) platforms.
---
 iocore/aio/Inline.cc   | 2 --
 iocore/cache/Inline.cc | 2 --
 iocore/dns/Inline.cc   | 2 --
 iocore/eventsystem/Inline.cc   | 2 --
 iocore/eventsystem/unit_tests/test_IOBuffer.cc | 3 ---
 iocore/hostdb/Inline.cc| 2 --
 iocore/net/Inline.cc   | 2 --
 iocore/net/test_I_UDPNet.cc| 5 -
 8 files changed, 20 deletions(-)

diff --git a/iocore/aio/Inline.cc b/iocore/aio/Inline.cc
index 03ba7b0..8e9b6d3 100644
--- a/iocore/aio/Inline.cc
+++ b/iocore/aio/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_AIO.h"
-#endif
diff --git a/iocore/cache/Inline.cc b/iocore/cache/Inline.cc
index 80b7af8..ecd72d2 100644
--- a/iocore/cache/Inline.cc
+++ b/iocore/cache/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_Cache.h"
-#endif
diff --git a/iocore/dns/Inline.cc b/iocore/dns/Inline.cc
index c7142c7..27da8cd 100644
--- a/iocore/dns/Inline.cc
+++ b/iocore/dns/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_DNS.h"
-#endif
diff --git a/iocore/eventsystem/Inline.cc b/iocore/eventsystem/Inline.cc
index 98a80a3..dc708c2 100644
--- a/iocore/eventsystem/Inline.cc
+++ b/iocore/eventsystem/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_EventSystem.h"
-#endif
diff --git a/iocore/eventsystem/unit_tests/test_IOBuffer.cc 
b/iocore/eventsystem/unit_tests/test_IOBuffer.cc
index 0fc3518..1c2c407 100644
--- a/iocore/eventsystem/unit_tests/test_IOBuffer.cc
+++ b/iocore/eventsystem/unit_tests/test_IOBuffer.cc
@@ -28,9 +28,6 @@
 
 #include "I_EventSystem.h"
 #include "RecordsConfig.h"
-#if defined(darwin)
-#include "P_IOBuffer.h"
-#endif
 
 #include "diags.i"
 
diff --git a/iocore/hostdb/Inline.cc b/iocore/hostdb/Inline.cc
index 17cb3fe..dd8fb46 100644
--- a/iocore/hostdb/Inline.cc
+++ b/iocore/hostdb/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_HostDB.h"
-#endif
diff --git a/iocore/net/Inline.cc b/iocore/net/Inline.cc
index fe9fe52..96716d6 100644
--- a/iocore/net/Inline.cc
+++ b/iocore/net/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_Net.h"
-#endif
diff --git a/iocore/net/test_I_UDPNet.cc b/iocore/net/test_I_UDPNet.cc
index 39f6c11..dca7e0a 100644
--- a/iocore/net/test_I_UDPNet.cc
+++ b/iocore/net/test_I_UDPNet.cc
@@ -31,13 +31,8 @@
 #include "I_EventSystem.h"
 #include "I_Net.h"
 #include "I_UDPNet.h"
-#if defined(darwin)
-#include "P_UDPConnection.h"
-#include "P_UDPPacket.h"
-#else
 #include "I_UDPPacket.h"
 #include "I_UDPConnection.h"
-#endif
 
 #include "diags.i"
 



[trafficserver] branch 9.0.x updated: Revert "Disable compiling Inline.cc on macOS (#7389)"

2021-03-09 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 423c888  Revert "Disable compiling Inline.cc on macOS (#7389)"
423c888 is described below

commit 423c8883ed004b516a0598b0124563c937de29c0
Author: Leif Hedstrom 
AuthorDate: Tue Mar 9 10:03:48 2021 -0700

Revert "Disable compiling Inline.cc on macOS (#7389)"

This reverts commit bc41ebdf6fbcb941ab904608ffcaf4b126f10e3b.

This PR breaks builds on regular (Intel) Mac's.
---
 iocore/aio/Inline.cc   | 2 --
 iocore/cache/Inline.cc | 2 --
 iocore/dns/Inline.cc   | 2 --
 iocore/eventsystem/Inline.cc   | 2 --
 iocore/eventsystem/unit_tests/test_IOBuffer.cc | 3 ---
 iocore/hostdb/Inline.cc| 2 --
 iocore/net/Inline.cc   | 2 --
 iocore/net/test_I_UDPNet.cc| 5 -
 8 files changed, 20 deletions(-)

diff --git a/iocore/aio/Inline.cc b/iocore/aio/Inline.cc
index 03ba7b0..8e9b6d3 100644
--- a/iocore/aio/Inline.cc
+++ b/iocore/aio/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_AIO.h"
-#endif
diff --git a/iocore/cache/Inline.cc b/iocore/cache/Inline.cc
index 80b7af8..ecd72d2 100644
--- a/iocore/cache/Inline.cc
+++ b/iocore/cache/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_Cache.h"
-#endif
diff --git a/iocore/dns/Inline.cc b/iocore/dns/Inline.cc
index c7142c7..27da8cd 100644
--- a/iocore/dns/Inline.cc
+++ b/iocore/dns/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_DNS.h"
-#endif
diff --git a/iocore/eventsystem/Inline.cc b/iocore/eventsystem/Inline.cc
index 98a80a3..dc708c2 100644
--- a/iocore/eventsystem/Inline.cc
+++ b/iocore/eventsystem/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_EventSystem.h"
-#endif
diff --git a/iocore/eventsystem/unit_tests/test_IOBuffer.cc 
b/iocore/eventsystem/unit_tests/test_IOBuffer.cc
index 0fc3518..1c2c407 100644
--- a/iocore/eventsystem/unit_tests/test_IOBuffer.cc
+++ b/iocore/eventsystem/unit_tests/test_IOBuffer.cc
@@ -28,9 +28,6 @@
 
 #include "I_EventSystem.h"
 #include "RecordsConfig.h"
-#if defined(darwin)
-#include "P_IOBuffer.h"
-#endif
 
 #include "diags.i"
 
diff --git a/iocore/hostdb/Inline.cc b/iocore/hostdb/Inline.cc
index 17cb3fe..dd8fb46 100644
--- a/iocore/hostdb/Inline.cc
+++ b/iocore/hostdb/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_HostDB.h"
-#endif
diff --git a/iocore/net/Inline.cc b/iocore/net/Inline.cc
index fe9fe52..96716d6 100644
--- a/iocore/net/Inline.cc
+++ b/iocore/net/Inline.cc
@@ -26,7 +26,5 @@
  *
  */
 
-#if !defined(darwin)
 #define TS_INLINE
 #include "P_Net.h"
-#endif
diff --git a/iocore/net/test_I_UDPNet.cc b/iocore/net/test_I_UDPNet.cc
index c09167c..9f50efe 100644
--- a/iocore/net/test_I_UDPNet.cc
+++ b/iocore/net/test_I_UDPNet.cc
@@ -31,13 +31,8 @@
 #include "I_EventSystem.h"
 #include "I_Net.h"
 #include "I_UDPNet.h"
-#if defined(darwin)
-#include "P_UDPConnection.h"
-#include "P_UDPPacket.h"
-#else
 #include "I_UDPPacket.h"
 #include "I_UDPConnection.h"
-#endif
 
 #include "diags.i"
 



[trafficserver] branch master updated: Generalize ALPN logic (#7555)

2021-03-09 Thread maskit
This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
 new cb247c6  Generalize ALPN logic (#7555)
cb247c6 is described below

commit cb247c6af699cb08286f04bd2ef481031b5babc7
Author: Masakazu Kitajo 
AuthorDate: Tue Mar 9 17:31:10 2021 +0900

Generalize ALPN logic (#7555)
---
 iocore/net/ALPNSupport.cc   | 59 +
 iocore/net/P_ALPNSupport.h  | 13 
 iocore/net/P_QUICNetVConnection.h   |  3 --
 iocore/net/P_SSLNetVConnection.h|  3 --
 iocore/net/QUICMultiCertConfigLoader.cc | 12 ---
 iocore/net/QUICMultiCertConfigLoader.h  |  2 --
 iocore/net/QUICNetVConnection.cc| 22 
 iocore/net/SSLNetVConnection.cc | 44 ++--
 iocore/net/SSLUtils.cc  | 35 +--
 iocore/net/quic/QUICConnection.h|  2 --
 10 files changed, 107 insertions(+), 88 deletions(-)

diff --git a/iocore/net/ALPNSupport.cc b/iocore/net/ALPNSupport.cc
index bf6874c..d643ab4 100644
--- a/iocore/net/ALPNSupport.cc
+++ b/iocore/net/ALPNSupport.cc
@@ -25,6 +25,35 @@
 #include "P_SSLNextProtocolSet.h"
 #include "records/I_RecHttp.h"
 
+int ALPNSupport::_ex_data_index = -1;
+
+void
+ALPNSupport::initialize()
+{
+  ink_assert(_ex_data_index == -1);
+  if (_ex_data_index == -1) {
+_ex_data_index = SSL_get_ex_new_index(0, (void *)"ALPNSupport index", 
nullptr, nullptr, nullptr);
+  }
+}
+
+ALPNSupport *
+ALPNSupport::getInstance(SSL *ssl)
+{
+  return static_cast(SSL_get_ex_data(ssl, _ex_data_index));
+}
+
+void
+ALPNSupport::bind(SSL *ssl, ALPNSupport *alpns)
+{
+  SSL_set_ex_data(ssl, _ex_data_index, alpns);
+}
+
+void
+ALPNSupport::unbind(SSL *ssl)
+{
+  SSL_set_ex_data(ssl, _ex_data_index, nullptr);
+}
+
 void
 ALPNSupport::clear()
 {
@@ -53,6 +82,36 @@ ALPNSupport::setSelectedProtocol(const unsigned char *proto, 
unsigned int len)
   return true;
 }
 
+int
+ALPNSupport::advertise_next_protocol(SSL *ssl, const unsigned char **out, 
unsigned *outlen)
+{
+  if (this->getNPN(out, outlen)) {
+// Successful return tells OpenSSL to advertise.
+return SSL_TLSEXT_ERR_OK;
+  }
+  return SSL_TLSEXT_ERR_NOACK;
+}
+
+int
+ALPNSupport::select_next_protocol(SSL *ssl, const unsigned char **out, 
unsigned char *outlen, const unsigned char *in,
+  unsigned inlen)
+{
+  const unsigned char *npnptr = nullptr;
+  unsigned int npnsize= 0;
+  if (this->getNPN(, )) {
+// SSL_select_next_proto chooses the first server-offered protocol that 
appears in the clients protocol set, ie. the
+// server selects the protocol. This is a n^2 search, so it's preferable 
to keep the protocol set short.
+if (SSL_select_next_proto(const_cast(out), outlen, 
npnptr, npnsize, in, inlen) == OPENSSL_NPN_NEGOTIATED) {
+  Debug("ssl", "selected ALPN protocol %.*s", (int)(*outlen), *out);
+  return SSL_TLSEXT_ERR_OK;
+}
+  }
+
+  *out= nullptr;
+  *outlen = 0;
+  return SSL_TLSEXT_ERR_NOACK;
+}
+
 void
 ALPNSupport::disableProtocol(int idx)
 {
diff --git a/iocore/net/P_ALPNSupport.h b/iocore/net/P_ALPNSupport.h
index e403122..fe39800 100644
--- a/iocore/net/P_ALPNSupport.h
+++ b/iocore/net/P_ALPNSupport.h
@@ -24,6 +24,7 @@
 
 #pragma once
 #include "records/I_RecHttp.h"
+#include 
 
 class SSLNextProtocolSet;
 class SSLNextProtocolAccept;
@@ -32,12 +33,22 @@ class Continuation;
 class ALPNSupport
 {
 public:
+  virtual ~ALPNSupport() = default;
+
+  static void initialize();
+  static ALPNSupport *getInstance(SSL *ssl);
+  static void bind(SSL *ssl, ALPNSupport *alpns);
+  static void unbind(SSL *ssl);
+
   void registerNextProtocolSet(SSLNextProtocolSet *, const SessionProtocolSet 
);
   void disableProtocol(int idx);
   void enableProtocol(int idx);
   void clear();
   bool setSelectedProtocol(const unsigned char *proto, unsigned int len);
 
+  int advertise_next_protocol(SSL *ssl, const unsigned char **out, unsigned 
*outlen);
+  int select_next_protocol(SSL *ssl, const unsigned char **out, unsigned char 
*outlen, const unsigned char *in, unsigned inlen);
+
   Continuation *
   endpoint() const
   {
@@ -65,6 +76,8 @@ public:
   int get_negotiated_protocol_id() const;
 
 private:
+  static int _ex_data_index;
+
   const SSLNextProtocolSet *npnSet = nullptr;
   SessionProtocolSet protoenabled;
   // Local copies of the npn strings
diff --git a/iocore/net/P_QUICNetVConnection.h 
b/iocore/net/P_QUICNetVConnection.h
index f04f32d..bcc23b1 100644
--- a/iocore/net/P_QUICNetVConnection.h
+++ b/iocore/net/P_QUICNetVConnection.h
@@ -186,9 +186,6 @@ public:
   int populate_protocol(std::string_view *results, int n) const override;
   const char *protocol_contains(std::string_view tag) const override;
 
-  int select_next_protocol(SSL *ssl, const unsigned char **out,