summaryrefslogtreecommitdiffstats
path: root/modules/public/dynamic.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2020-12-24 12:25:17 +0800
committerGitHub <noreply@github.com>2020-12-24 12:25:17 +0800
commit19ae6439b0956a578100b50cb09b1cbd40a01942 (patch)
tree48ad57f2d5fdb5c2d00735585c07089f795477d3 /modules/public/dynamic.go
parent87a0396719dc12a19e9876bd4e5ba6ea008072d8 (diff)
downloadgitea-19ae6439b0956a578100b50cb09b1cbd40a01942.tar.gz
gitea-19ae6439b0956a578100b50cb09b1cbd40a01942.zip
Improve vfsgen to not unzip bindata files but send to browser directly (#7109)
* Don't unzip files from bindata but send to browser directly * remove dependent for httpgzip * Add tests for parseAcceptEncoding * Update docs for ENABLE_GZIP * Fix bug * Fix bug Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'modules/public/dynamic.go')
-rw-r--r--modules/public/dynamic.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/public/dynamic.go b/modules/public/dynamic.go
index f1a4dbb1a3..f634c598a3 100644
--- a/modules/public/dynamic.go
+++ b/modules/public/dynamic.go
@@ -6,9 +6,19 @@
package public
-import "net/http"
+import (
+ "io"
+ "net/http"
+ "os"
+ "time"
+)
// Static implements the macaron static handler for serving assets.
func Static(opts *Options) func(next http.Handler) http.Handler {
return opts.staticHandler(opts.Directory)
}
+
+// ServeContent serve http content
+func ServeContent(w http.ResponseWriter, req *http.Request, fi os.FileInfo, modtime time.Time, content io.ReadSeeker) {
+ http.ServeContent(w, req, fi.Name(), modtime, content)
+}