From e0c67f53ef565c1e91c851fe98a8c115673e6de5 Mon Sep 17 00:00:00 2001 From: Andrew Stuart Date: Tue, 31 Jan 2017 08:11:54 -0700 Subject: [PATCH 1/2] bugfix (cli) Update the URL check to work with https --- fission/common.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fission/common.go b/fission/common.go index d25d2950c..a4926fca2 100644 --- a/fission/common.go +++ b/fission/common.go @@ -35,7 +35,12 @@ func getClient(serverUrl string) *client.Client { fatal("Need --server or FISSION_URL set to your fission server.") } - serverUrl = "http://" + strings.TrimPrefix(serverUrl, "http://") + isHttps := strings.Index(serverUrl, "https://") == 0 + isHttp := strings.Index(serverUrl, "http://") == 0 + + if !isHttp && !isHttps { + serverUrl = "http://" + serverUrl + } return client.MakeClient(serverUrl) } From 11a9ebc20454bc1fd40723a009d385d02735012d Mon Sep 17 00:00:00 2001 From: Andrew Stuart Date: Tue, 31 Jan 2017 08:25:57 -0700 Subject: [PATCH 2/2] Satisfy golint, clarify logic --- fission/common.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fission/common.go b/fission/common.go index a4926fca2..1e56677db 100644 --- a/fission/common.go +++ b/fission/common.go @@ -35,10 +35,10 @@ func getClient(serverUrl string) *client.Client { fatal("Need --server or FISSION_URL set to your fission server.") } - isHttps := strings.Index(serverUrl, "https://") == 0 - isHttp := strings.Index(serverUrl, "http://") == 0 + isHTTPS := strings.Index(serverUrl, "https://") == 0 + isHTTP := strings.Index(serverUrl, "http://") == 0 - if !isHttp && !isHttps { + if !(isHTTP || isHTTPS) { serverUrl = "http://" + serverUrl }