summaryrefslogtreecommitdiffstats
path: root/modules/public/public.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/public/public.go')
-rw-r--r--modules/public/public.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/public/public.go b/modules/public/public.go
index fc933637d8..c8148e6db3 100644
--- a/modules/public/public.go
+++ b/modules/public/public.go
@@ -87,6 +87,16 @@ func (opts *Options) staticHandler(dir string) func(next http.Handler) http.Hand
}
}
+// parseAcceptEncoding parse Accept-Encoding: deflate, gzip;q=1.0, *;q=0.5 as compress methods
+func parseAcceptEncoding(val string) map[string]bool {
+ parts := strings.Split(val, ";")
+ var types = make(map[string]bool)
+ for _, v := range strings.Split(parts[0], ",") {
+ types[strings.TrimSpace(v)] = true
+ }
+ return types
+}
+
func (opts *Options) handle(w http.ResponseWriter, req *http.Request, opt *Options) bool {
if req.Method != "GET" && req.Method != "HEAD" {
return false
@@ -157,6 +167,6 @@ func (opts *Options) handle(w http.ResponseWriter, req *http.Request, opt *Optio
return true
}
- http.ServeContent(w, req, file, fi.ModTime(), f)
+ ServeContent(w, req, fi, fi.ModTime(), f)
return true
}