diff --git a/api/api_test.go b/api/api_test.go index 4f9ae2a51..3df5c99f5 100644 --- a/api/api_test.go +++ b/api/api_test.go @@ -107,7 +107,7 @@ func TestRequestUnparsedResponseUsingAccessTokenParameterFailedResponse(t *testi func TestRequestUnparsedResponseUsingHeaders(t *testing.T) { backend := httptest.NewServer(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/" && r.Header["Auth"][0] == "my_token" { + if r.URL.Path == "/" && r.Header.Get("Auth") == "my_token" { w.WriteHeader(200) w.Write([]byte("some payload")) } else { diff --git a/http.go b/http.go index 57cac5a5f..c0c0ae083 100644 --- a/http.go +++ b/http.go @@ -125,7 +125,8 @@ func extractClientIP(req *http.Request, header string) string { func redirectToHTTPS(h http.Handler, httpsAddr string) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.TLS == nil && strings.ToLower(r.Header.Get("X-Forwarded-Proto")) != "https" { + proto := strings.ToLower(r.Header.Get("X-Forwarded-Proto")) + if ((r.TLS == nil && proto != "https") || (r.TLS != nil && proto == "http")) && r.URL.Path != "/ping" { url := *r.URL host := strings.Split(r.Host, ":")[0] if !strings.HasSuffix(httpsAddr, ":443") { diff --git a/providers/github.go b/providers/github.go index 398127d71..b7d8a13f3 100644 --- a/providers/github.go +++ b/providers/github.go @@ -188,7 +188,7 @@ func (p *GitHubProvider) hasOrgAndTeam(accessToken string) (bool, error) { } } - matches := pattern.FindStringSubmatch(resp.Header["Link"][0]) + matches := pattern.FindStringSubmatch(resp.Header.Get("Link")) if len(matches) == 0 { break } diff --git a/version.go b/version.go index e51b93f6c..b31f06d95 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package main -const VERSION = "2.6.1-beta" +const VERSION = "2.7.0"