TSVCONNPR...LE/DISABLE(3ts)

πŸ“¦
version 9.2.5 Β· 4 versions
, in ubuntu noble, ubuntu questing

πŸ’– TSVConnProtocolEnable/Disable β€” the TSVConnProtocol API function ✨

okay bestie, so this is the page for TSVConnProtocolEnable and TSVConnProtocolDisable from Apache Traffic Server πŸŽ€ β€” two little functions that let you boss around which protocols get advertised during TLS protocol negotiation. no cap.


🌸 SYNOPSIS 🌸

#include <ts/ts.h>

TSReturnCode TSVConnProtocolEnable(TSVConn vconn, const char *protocol)

TSReturnCode TSVConnProtocolDisable(TSVConn vconn, const char *protocol)

πŸ¦‹ DESCRIPTION πŸ¦‹

so, TSVConnProtocolEnable() turns on the protocol you pass in as protocol, so it gets advertised in the TLS protocol negotiation. it's giving "yes bestie, we support this, put it on the menu" πŸ’…

and TSVConnProtocolDisable() is the reverse β€” it takes the protocol named by protocol right out of the TLS protocol negotiation. gone. not invited to the party. πŸ’€

🫢 IMPORTANT VIBE CHECK: for these calls to actually do anything, you have to make them from the early TLS negotiation hooks β€” like TS_SSL_CLIENT_HELLO_HOOK or TS_SSL_SERVERNAME_HOOK. do it too late and it's giving "too late, the door's already closed" 😭 timing is literally everything here.

⭐ EXAMPLES ⭐

this next bit is excerpted from example/plugins/c-api/disable_http2/disable_http2.cc in the Traffic Server source distribution πŸ“‚. it shows how you'd use TSVConnProtocolDisable() inside a plugin called from the TS_SSL_SERVERNAME_HOOK. look at her go πŸ”₯

int
CB_SNI(TSCont contp, TSEvent, void *cb_data)
{
  auto vc                  = static_cast<TSVConn>(cb_data);
  TSSslConnection ssl_conn = TSVConnSslConnectionGet(vc);
  auto *ssl                = reinterpret_cast<SSL *>(ssl_conn);
  char const *sni          = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
  if (sni) {
    if (Domains.find(sni) != Domains.end()) {
      TSDebug(PLUGIN_NAME, "Disable H2 for SNI=%s", sni);
      TSVConnProtocolDisable(vc, TS_ALPN_PROTOCOL_HTTP_2_0);
    }
  }

2026, dev@trafficserver.apache.org πŸ’œ


and that's the whole page, bestie 🧚 β€” Apache Traffic Server, version 9.2, dated Feb 12, 2026. go forth and negotiate those protocols responsibly. periodt. πŸ’–βœ¨

πŸ“¦ where this page comes from