diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2021-04-10 22:04:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-10 22:04:44 +0200 |
commit | 8d55d8b6be8731d37ccf6a29127b3a91a8319d0b (patch) | |
tree | 4495109b4d5a7a71d4d12fbe814292b1e5a97c6a /runtime/ops | |
parent | 1c6602b85b50bc45cbf8cd1422091888e1561cd8 (diff) |
feat(unstable): ALPN config in listenTls (#10065)
This commit adds the ability for users to configure ALPN protocols when
calling `Deno.listenTls`.
Diffstat (limited to 'runtime/ops')
-rw-r--r-- | runtime/ops/tls.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runtime/ops/tls.rs b/runtime/ops/tls.rs index d9c5f1854..83dbbfcd1 100644 --- a/runtime/ops/tls.rs +++ b/runtime/ops/tls.rs @@ -300,6 +300,7 @@ pub struct ListenTlsArgs { port: u16, cert_file: String, key_file: String, + alpn_protocols: Option<Vec<String>>, } fn op_listen_tls( @@ -318,6 +319,11 @@ fn op_listen_tls( permissions.read.check(Path::new(&key_file))?; } let mut config = ServerConfig::new(NoClientAuth::new()); + if let Some(alpn_protocols) = args.alpn_protocols { + super::check_unstable(state, "Deno.listenTls#alpn_protocols"); + config.alpn_protocols = + alpn_protocols.into_iter().map(|s| s.into_bytes()).collect(); + } config .set_single_cert(load_certs(&cert_file)?, load_keys(&key_file)?.remove(0)) .expect("invalid key or certificate"); |