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:
authorJaime Martinez <jmartinez@gitlab.com>2020-09-21 10:55:58 +0300
committerVladimir Shushlin <v.shushlin@gmail.com>2020-09-21 13:53:18 +0300
commit92bef3ba5a9ebc9aad6abe661c900e13fdd27580 (patch)
tree6a8e354a80a1b6786b2b05ebe23f63bc3811e313
parentaf662b8ddaf8942dc08947c59c702e862918fe51 (diff)
Update notes about serving compressed files
-rw-r--r--internal/serving/disk/reader.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go
index caaccdc3..5b34c556 100644
--- a/internal/serving/disk/reader.go
+++ b/internal/serving/disk/reader.go
@@ -11,7 +11,6 @@ import (
"time"
"github.com/prometheus/client_golang/prometheus"
- log "github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitlab-pages/internal/redirects"
"gitlab.com/gitlab-org/gitlab-pages/internal/serving"
@@ -199,12 +198,12 @@ func (reader *Reader) serveFile(ctx context.Context, w http.ResponseWriter, r *h
reader.fileSizeMetric.Observe(float64(fi.Size()))
- // This is just a failsafe as we need to assert that file is of type
- // vfs.SeekableFile before passing onto http.ServeContent
+ // Support vfs.SeekableFile if available (uncompressed files)
if rs, ok := file.(vfs.SeekableFile); ok {
http.ServeContent(w, r, origPath, fi.ModTime(), rs)
} else {
- log.WithField("filename", fi.Name()).Traceln("file is not seekable")
+ // compressed files will be served by io.Copy
+ // TODO: Add extra headers https://gitlab.com/gitlab-org/gitlab-pages/-/issues/466
w.Header().Set("Content-Length", strconv.FormatInt(fi.Size(), 10))
io.Copy(w, file)
}