From cb438297cb863e03ced6a8511471b8c6e283578f Mon Sep 17 00:00:00 2001 From: Konstantin Kushnir Date: Mon, 27 May 2024 07:27:22 +0000 Subject: [PATCH] Create compatibility aliases in ::tls namespace --- ChangeLog | 3 +++ README.md | 11 +++++++- doc/doc.ruff | 11 +++++++- doc/mtls.html | 3 ++- doc/mtls.n | 11 +++++++- generic/tclmtls.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++ manifest.uuid | 2 +- tests/basic.test | 33 ++++++++++++++++++++++++ 8 files changed, 133 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e96d7e..c90e643 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2024-05-27 Konstantin Kushnir + * Create compatibility aliases in ::tls namespace by default + 2024-05-12 Konstantin Kushnir * Fix an issue with untrusted certificates with TLS1.3 protocol * Add test cases from https://github.com/wbond/badtls.io diff --git a/README.md b/README.md index e0dac0f..152bf6d 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,15 @@ Typically one would use the [socket](README\.html\#::mtls::socket) command which compatibility with the native Tcl [socket](https://www.tcl.tk/man/tcl8.6/TclCmd/socket.htm) command. In such cases [import](README\.html\#::mtls::import) should not be used directly. +Please note, to ensure seamless use of both the classic tcltls package +and this package, command aliases are created in the `::tls` namespace +when loading mtls. This allows the same code base to be used when using +different packages to support SSL/TLS connections. However, aliases +will not be created if the `::tls` namespace already exists at the time +the mtls package is loaded. This in turn allows both the tcltls and +mtls packages to be loaded at the same time. But the tcltls package +must be loaded first. + ## HTTPS examples ### client example @@ -142,7 +151,7 @@ command. In such cases [import](README\.html\#::mtls::import) should not be used package require http package require mtls -http::register https 443 ::tls::socket +http::register https 443 ::mtls::socket set tok [http::geturl https://www.tcl.tk/] diff --git a/doc/doc.ruff b/doc/doc.ruff index 7e3c1fb..1e7717b 100644 --- a/doc/doc.ruff +++ b/doc/doc.ruff @@ -145,6 +145,15 @@ namespace eval mtls { compatibility with the native Tcl [socket](https://www.tcl.tk/man/tcl8.6/TclCmd/socket.htm) command. In such cases [import] should not be used directly. + Please note, to ensure seamless use of both the classic tcltls package + and this package, command aliases are created in the `::tls` namespace + when loading mtls. This allows the same code base to be used when using + different packages to support SSL/TLS connections. However, aliases + will not be created if the `::tls` namespace already exists at the time + the mtls package is loaded. This in turn allows both the tcltls and + mtls packages to be loaded at the same time. But the tcltls package + must be loaded first. + ## HTTPS examples ### client example @@ -153,7 +162,7 @@ namespace eval mtls { package require http package require mtls - http::register https 443 ::tls::socket + http::register https 443 ::mtls::socket set tok [http::geturl https://www.tcl.tk/] diff --git a/doc/mtls.html b/doc/mtls.html index 79719ef..c11dec1 100644 --- a/doc/mtls.html +++ b/doc/mtls.html @@ -102,6 +102,7 @@

Description

This Tcl package provides an extension which implements Transport Layer Security (TLS) over Transmission Control Protocol (TCP) network communication channels.

Typically one would use the socket command which provides compatibility with the native Tcl socket command. In such cases import should not be used directly.

+

Please note, to ensure seamless use of both the classic tcltls package and this package, command aliases are created in the ::tls namespace when loading mtls. This allows the same code base to be used when using different packages to support SSL/TLS connections. However, aliases will not be created if the ::tls namespace already exists at the time the mtls package is loaded. This in turn allows both the tcltls and mtls packages to be loaded at the same time. But the tcltls package must be loaded first.

HTTPS examplesmtls, Top

client examplemtls, Top

@@ -111,7 +112,7 @@

client example