hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit fb82f00f9d0341a976241c9c062304adb43b3794
parent b98c2088f83dfa663b2d74c959b0935deecdf399
Author: Mantas <mojavosas@gmail.com>
Date:   Mon,  6 Oct 2014 12:50:44 +0300

handle https prefixes in baseUrl

Diffstat:
Mcommands/server.go | 2+-
Mcommands/server_test.go | 3++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/commands/server.go b/commands/server.go
@@ -136,7 +136,7 @@ func fixUrl(s string) (string, error) {
 		s = viper.GetString("BaseUrl")
 		useLocalhost = true
 	}
-	if !strings.HasPrefix(s, "http://") {
+	if !strings.HasPrefix(s, "http://") && !strings.HasPrefix(s, "https://") {
 		s = "http://" + s
 	}
 	u, err := url.Parse(s)
diff --git a/commands/server_test.go b/commands/server_test.go
@@ -16,7 +16,8 @@ func TestFixUrl(t *testing.T) {
 		Result     string
 	}
 	tests := []data{
-		{"Basic localhost", "", "http://foo.com", true, 1313, "http://localhost:1313"},
+		{"Basic http localhost", "", "http://foo.com", true, 1313, "http://localhost:1313"},
+		{"Basic https localhost", "", "https://foo.com", true, 1313, "https://localhost:1313"},
 		{"Basic subdir", "", "http://foo.com/bar", true, 1313, "http://localhost:1313/bar"},
 		{"Basic production", "http://foo.com", "http://foo.com", false, 80, "http://foo.com"},
 		{"Production subdir", "http://foo.com/bar", "http://foo.com/bar", false, 80, "http://foo.com/bar"},