Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-07-02 18:14:40 +0300
committerTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-07-02 18:14:40 +0300
commit415f4224b04c631588fba386687e69b47cae9be4 (patch)
tree2ffefeaac5cecf81c2c7f97eeabace43915eeb26 /internal/domain
parente9253d07ddad509465d64ca58400e527bc378da9 (diff)
Get rid of panic serving errors
Diffstat (limited to 'internal/domain')
-rw-r--r--internal/domain/domain.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/domain/domain.go b/internal/domain/domain.go
index bf0129c8..e32ba097 100644
--- a/internal/domain/domain.go
+++ b/internal/domain/domain.go
@@ -110,6 +110,10 @@ func (d *D) getProject(r *http.Request) *project {
// IsHTTPSOnly figures out if the request should be handled with HTTPS
// only by looking at group and project level config.
func (d *D) IsHTTPSOnly(r *http.Request) bool {
+ if d == nil {
+ return false
+ }
+
if d.config != nil {
return d.config.HTTPSOnly
}
@@ -125,6 +129,10 @@ func (d *D) IsHTTPSOnly(r *http.Request) bool {
// IsAccessControlEnabled figures out if the request is to a project that has access control enabled
func (d *D) IsAccessControlEnabled(r *http.Request) bool {
+ if d == nil {
+ return false
+ }
+
project := d.getProject(r)
if project != nil {
@@ -337,6 +345,11 @@ func (d *D) EnsureCertificate() (*tls.Certificate, error) {
// ServeHTTP implements http.Handler.
func (d *D) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+ if d == nil {
+ httperrors.Serve404(w)
+ return
+ }
+
if d.config != nil {
d.serveFromConfig(w, r)
} else {