From 5ea8c16c5d8a5069b104ce1a7840f0fbb04790d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Fale=C5=A1n=C3=ADk?= Date: Mon, 9 Oct 2023 15:39:36 +0200 Subject: [PATCH] fix: strip port off the hostname. --- http-to-https-proxy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/http-to-https-proxy.go b/http-to-https-proxy.go index e4983f4..397b045 100644 --- a/http-to-https-proxy.go +++ b/http-to-https-proxy.go @@ -8,6 +8,7 @@ import ( "net/http/httputil" "os" "strconv" + "strings" ) var versionCode = "v0.3" @@ -44,7 +45,7 @@ func handler(responseToRequest http.ResponseWriter, incomingRequest *http.Reques } } - conn, err := tls.Dial("tcp", host+":"+strconv.Itoa(httpsConnectingPort), conf) + conn, err := tls.Dial("tcp", strings.Split(host, ":")[0]+":"+strconv.Itoa(httpsConnectingPort), conf) if err != nil { log.Printf("Cannot dial host %s", err) http.Error(responseToRequest, "Cannot dial host", http.StatusGatewayTimeout)