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:
authorVladimir Shushlin <v.shushlin@gmail.com>2021-12-14 17:26:30 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2021-12-15 13:32:45 +0300
commit0cfd85f8edd8f52db96b72b9efb99f0183053536 (patch)
tree6df208bb47e6447d051cc9cc67eaa8a4388e7e2f /internal/serving
parent097c4c0aec8ddb0028ed8be8ed338d87020c5a9b (diff)
feat: hide handling cache headers behind the faeture flag
vfsServing.ServeCompressedFile logic is quite comples, and I'm afraid that we may handle something not the right way So I want to hide this behind the feature flag before cutting the release Changelog: fixed
Diffstat (limited to 'internal/serving')
-rw-r--r--internal/serving/disk/reader.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go
index 2aeeeb27..ec97b128 100644
--- a/internal/serving/disk/reader.go
+++ b/internal/serving/disk/reader.go
@@ -14,6 +14,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
"gitlab.com/gitlab-org/labkit/errortracking"
+ "gitlab.com/gitlab-org/gitlab-pages/internal/feature"
"gitlab.com/gitlab-org/gitlab-pages/internal/httperrors"
"gitlab.com/gitlab-org/gitlab-pages/internal/logging"
"gitlab.com/gitlab-org/gitlab-pages/internal/redirects"
@@ -231,7 +232,11 @@ func (reader *Reader) serveFile(ctx context.Context, w http.ResponseWriter, r *h
http.ServeContent(w, r, origPath, fi.ModTime(), rs)
} else {
w.Header().Set("Content-Length", strconv.FormatInt(fi.Size(), 10))
- vfsServing.ServeCompressedFile(w, r, fi.ModTime(), file)
+ if feature.HandleCacheHeaders.Enabled() {
+ vfsServing.ServeCompressedFile(w, r, fi.ModTime(), file)
+ } else {
+ io.Copy(w, file)
+ }
}
return true