From 067c66f80ea2173d605ecf741fe5caca82b23606 Mon Sep 17 00:00:00 2001
From: Matus Fabian <matfabia@cisco.com>
Date: Fri, 7 Mar 2025 04:34:59 -0500
Subject: http: http_transport_connect TLS support

enable HTTPS for client apps

Type: improvement

Change-Id: I2ca8b926771a350863cca81729102faf6ee9c874
Signed-off-by: Matus Fabian <matfabia@cisco.com>
---
 extras/hs-test/http_test.go | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

(limited to 'extras/hs-test')

diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go
index 91d0823d9c3..ad43f9d032e 100644
--- a/extras/hs-test/http_test.go
+++ b/extras/hs-test/http_test.go
@@ -22,7 +22,7 @@ import (
 )
 
 func init() {
-	RegisterVethTests(HttpCliTest, HttpCliConnectErrorTest)
+	RegisterVethTests(HttpCliTest, HttpCliConnectErrorTest, HttpCliTlsTest)
 	RegisterSoloVethTests(HttpClientGetMemLeakTest)
 	RegisterNoTopoTests(HeaderServerTest, HttpPersistentConnectionTest, HttpPipeliningTest,
 		HttpStaticMovedTest, HttpStaticNotFoundTest, HttpCliMethodNotAllowedTest, HttpAbsoluteFormUriTest,
@@ -241,6 +241,25 @@ func HttpCliTest(s *VethsSuite) {
 	s.AssertContains(o, "</html>", "</html> not found in the result!")
 }
 
+func HttpCliTlsTest(s *VethsSuite) {
+	uri := "tls://" + s.Interfaces.Server.Ip4AddressString() + "/443"
+
+	s.Containers.ServerVpp.VppInstance.Vppctl("http cli server uri " + uri)
+
+	o := s.Containers.ClientVpp.VppInstance.Vppctl("http cli client" +
+		" uri " + uri + " query /show/version")
+	s.Log(o)
+	s.AssertContains(o, "<html>", "<html> not found in the result!")
+	s.AssertContains(o, "</html>", "</html> not found in the result!")
+
+	/* second request to test postponed ho-cleanup */
+	o = s.Containers.ClientVpp.VppInstance.Vppctl("http cli client" +
+		" uri " + uri + " query /show/version")
+	s.Log(o)
+	s.AssertContains(o, "<html>", "<html> not found in the result!")
+	s.AssertContains(o, "</html>", "</html> not found in the result!")
+}
+
 func HttpCliConnectErrorTest(s *VethsSuite) {
 	uri := "http://" + s.Interfaces.Server.Ip4AddressString() + "/80"
 
-- 
cgit