You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/05/21 05:04:37 UTC

[trafficserver] branch quic-latest updated: Set ALPN ext for quic client

This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/quic-latest by this push:
     new cc560cf  Set ALPN ext for quic client
cc560cf is described below

commit cc560cf271f0f6f0cadd56f6b992ee24d48c0807
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Mon May 21 14:03:47 2018 +0900

    Set ALPN ext for quic client
---
 iocore/net/quic/QUICConfig.cc | 6 +++++-
 iocore/net/quic/QUICTypes.h   | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/iocore/net/quic/QUICConfig.cc b/iocore/net/quic/QUICConfig.cc
index 8b75993..bd6294b 100644
--- a/iocore/net/quic/QUICConfig.cc
+++ b/iocore/net/quic/QUICConfig.cc
@@ -24,6 +24,7 @@
 #include "QUICConfig.h"
 
 #include <openssl/ssl.h>
+
 #include <records/I_RecHttp.h>
 
 #include "P_SSLConfig.h"
@@ -88,7 +89,10 @@ quic_init_client_ssl_ctx(const QUICConfigParams *params)
 {
   SSL_CTX *ssl_ctx = quic_new_ssl_ctx();
 
-  // SSL_CTX_set_alpn_protos()
+  if (SSL_CTX_set_alpn_protos(ssl_ctx, reinterpret_cast<const unsigned char *>(QUIC_ALPN_PROTO_LIST.data()),
+                              QUIC_ALPN_PROTO_LIST.size()) != 0) {
+    Error("SSL_CTX_set_alpn_protos failed");
+  }
 
   if (params->client_supported_groups() != nullptr) {
     if (SSL_CTX_set1_groups_list(ssl_ctx, params->client_supported_groups()) != 1) {
diff --git a/iocore/net/quic/QUICTypes.h b/iocore/net/quic/QUICTypes.h
index 552b685..715b37c 100644
--- a/iocore/net/quic/QUICTypes.h
+++ b/iocore/net/quic/QUICTypes.h
@@ -53,6 +53,11 @@ constexpr QUICVersion QUIC_EXERCISE_VERSIONS = 0x1a2a3a4a;
 
 constexpr QUICStreamId STREAM_ID_FOR_HANDSHAKE = 0;
 
+// OpenSSL protocol-lists format (vector of 8-bit length-prefixed, byte strings)
+// https://www.openssl.org/docs/manmaster/man3/SSL_CTX_set_alpn_protos.html
+// Should be integrate with IP_PROTO_TAG_HTTP_QUIC in ts/ink_inet.h ?
+constexpr std::string_view QUIC_ALPN_PROTO_LIST("\5hq-11"sv);
+
 enum class QUICHandshakeMsgType {
   NONE = 0,
   INITIAL,

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.