summaryrefslogtreecommitdiff
path: root/pages.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2014-06-01 13:21:45 +0200
committerKevin Chabowski <kevin@kch42.de>2014-06-01 13:21:45 +0200
commitaff7bc512d5726a020e4107690abd24ae91b1b48 (patch)
tree1dd1e5f0222ca6b0a547c412dfe9a8d2c32015fa /pages.go
parente9fa4b6c8a552bfe715f048f189e813d7026b442 (diff)
downloadsimplechat-aff7bc512d5726a020e4107690abd24ae91b1b48.tar.gz
simplechat-aff7bc512d5726a020e4107690abd24ae91b1b48.tar.bz2
simplechat-aff7bc512d5726a020e4107690abd24ae91b1b48.zip
Added TLS support
Diffstat (limited to 'pages.go')
-rw-r--r--pages.go6
1 files changed, 5 insertions, 1 deletions
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"]})
}