diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2021-08-16 10:13:08 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2021-08-16 10:25:25 +0300 |
commit | a54a0b6a1c5f9dfe39a00e01aaacc4f0ddf9754a (patch) | |
tree | 664f0e0c51993d076acb28bf020801d65558c9eb | |
parent | d4f76c30c37307de77041cc72cc5d45036e3ad7a (diff) |
chore: remove unnecessary func
and fields added by mistake
-rw-r--r-- | app.go | 1 | ||||
-rw-r--r-- | internal/auth/auth.go | 4 | ||||
-rw-r--r-- | internal/domain/domain.go | 11 | ||||
-rw-r--r-- | main.go | 2 | ||||
-rw-r--r-- | test/acceptance/acceptance_test.go | 17 | ||||
-rw-r--r-- | test/acceptance/helpers_test.go | 2 | ||||
-rw-r--r-- | test/acceptance/stub_test.go | 1 |
7 files changed, 3 insertions, 35 deletions
@@ -94,7 +94,6 @@ func (a *theApp) redirectToHTTPS(w http.ResponseWriter, r *http.Request, statusC func (a *theApp) getHostAndDomain(r *http.Request) (string, *domain.Domain, error) { host := request.GetHostWithoutPort(r) - domain, err := a.domain(r.Context(), host) return host, domain, err diff --git a/internal/auth/auth.go b/internal/auth/auth.go index bff09778..29aaa582 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -10,7 +10,6 @@ import ( "io" "net" "net/http" - "net/http/httputil" "net/url" "strings" "time" @@ -507,9 +506,6 @@ func (a *Auth) checkAuthentication(w http.ResponseWriter, r *http.Request, domai } req.Header.Add("Authorization", "Bearer "+session.Values["access_token"].(string)) - - dreq, err := httputil.DumpRequestOut(req, false) - fmt.Printf("Fetching access token: %s\n%+v\n", dreq, err) resp, err := a.apiClient.Do(req) if err != nil { diff --git a/internal/domain/domain.go b/internal/domain/domain.go index eb4d8e86..94888e34 100644 --- a/internal/domain/domain.go +++ b/internal/domain/domain.go @@ -4,7 +4,6 @@ import ( "context" "crypto/tls" "errors" - "fmt" "net/http" "sync" @@ -162,7 +161,6 @@ func (d *Domain) ServeNotFoundHTTP(w http.ResponseWriter, r *http.Request) { // that failed authentication so that we serve the custom namespace error page for // public namespace domains func (d *Domain) serveNamespaceNotFound(w http.ResponseWriter, r *http.Request) { - fmt.Printf("serveNamespaceNotFound-1\n") // clone r and override the path and try to resolve the domain name clonedReq := r.Clone(context.Background()) clonedReq.URL.Path = "/" @@ -179,32 +177,29 @@ func (d *Domain) serveNamespaceNotFound(w http.ResponseWriter, r *http.Request) httperrors.Serve503(w) return } - fmt.Printf("serveNamespaceNotFound-2\n") - fmt.Printf("namespaceDomain.LookupPath:%+v\n", namespaceDomain.LookupPath) + // for namespace domains that have no access control enabled if !namespaceDomain.LookupPath.HasAccessControl { namespaceDomain.ServeNotFoundHTTP(w, r) return } - fmt.Printf("serveNamespaceNotFound-3\n") + httperrors.Serve404(w) } // ServeNotFoundAuthFailed handler to be called when auth failed so the correct custom // 404 page is served. func (d *Domain) ServeNotFoundAuthFailed(w http.ResponseWriter, r *http.Request) { - fmt.Printf("ServeNotFoundAuthFailed-1\n") lookupPath, err := d.GetLookupPath(r) if err != nil { httperrors.Serve404(w) return } - fmt.Printf("ServeNotFoundAuthFailed-2\n") if d.IsNamespaceProject(r) && !lookupPath.HasAccessControl { d.ServeNotFoundHTTP(w, r) return } - fmt.Printf("ServeNotFoundAuthFailed-3\n") + d.serveNamespaceNotFound(w, r) } @@ -70,9 +70,7 @@ func appMain() { "revision": REVISION, }).Info("GitLab Pages Daemon") log.Info("URL: https://gitlab.com/gitlab-org/gitlab-pages") - wd, err := os.Getwd() - fmt.Printf("wd: %q\nerr:%+v\nroot:%q\n", wd, err, config.General.RootDir) if err := os.Chdir(config.General.RootDir); err != nil { fatal(err, "could not change directory into pagesRoot") } diff --git a/test/acceptance/acceptance_test.go b/test/acceptance/acceptance_test.go index becae777..e6b50c10 100644 --- a/test/acceptance/acceptance_test.go +++ b/test/acceptance/acceptance_test.go @@ -67,20 +67,3 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } - -func skipUnlessEnabled(t *testing.T, conditions ...string) { - t.Helper() - - for _, condition := range conditions { - switch condition { - case "not-inplace-chroot": - if os.Getenv("TEST_DAEMONIZE") == "inplace" { - t.Log("Not supported with -daemon-inplace-chroot") - t.SkipNow() - } - default: - t.Error("Unknown condition:", condition) - t.FailNow() - } - } -} diff --git a/test/acceptance/helpers_test.go b/test/acceptance/helpers_test.go index 1c168b86..4ea28b2a 100644 --- a/test/acceptance/helpers_test.go +++ b/test/acceptance/helpers_test.go @@ -545,8 +545,6 @@ func waitForRoundtrips(t *testing.T, listeners []ListenSpec, timeout time.Durati type stubOpts struct { m sync.RWMutex apiCalled bool - enableSSL bool - enableSSLEnv bool statusReadyCount int authHandler http.HandlerFunc userHandler http.HandlerFunc diff --git a/test/acceptance/stub_test.go b/test/acceptance/stub_test.go index 6523c672..10bd3cf6 100644 --- a/test/acceptance/stub_test.go +++ b/test/acceptance/stub_test.go @@ -138,7 +138,6 @@ func CreateGitLabAPISecretKeyFixtureFile(t *testing.T) (filepath string) { return secretfile.Name() } -// TODO: NEED TO MOVE THIS to handler in api_responses func handleAccessControlArtifactRequests(t *testing.T, w http.ResponseWriter, r *http.Request) bool { authorization := r.Header.Get("Authorization") |