From aff7bc512d5726a020e4107690abd24ae91b1b48 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Sun, 1 Jun 2014 13:21:45 +0200 Subject: Added TLS support --- pages.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pages.go') diff --git a/pages.go b/pages.go index ebe284a..61ee0ae 100644 --- a/pages.go +++ b/pages.go @@ -44,5 +44,9 @@ func Home(rw http.ResponseWriter, req *http.Request) { func Chatpage(rw http.ResponseWriter, req *http.Request) { vars := mux.Vars(req) - TplChat.Execute(rw, ChatpageData{"ws://" + req.Host + strings.Replace(req.URL.Path+"/socket", "//", "/", -1), vars["chatroom"]}) + wsproto := "ws://" + if *usetls { + wsproto = "wss://" + } + TplChat.Execute(rw, ChatpageData{wsproto + req.Host + strings.Replace(req.URL.Path+"/socket", "//", "/", -1), vars["chatroom"]}) } -- cgit v1.2.3-70-g09d2