diff options
author | Steve Manuel <nilslice@gmail.com> | 2017-01-16 15:40:24 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2017-01-16 15:40:24 -0800 |
commit | 61ab44352906ae598fce12e47dbd7af9d17988cf (patch) | |
tree | 8b5107a2f8bd9b2630eb409d79778c8541936043 /system/api/handlers.go | |
parent | a645a66ecd2d68cb6719cb22bdb91a0480be8659 (diff) |
adding gzip_disabled config setting
Diffstat (limited to 'system/api/handlers.go')
-rw-r--r-- | system/api/handlers.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/system/api/handlers.go b/system/api/handlers.go index c3421f9..9292e15 100644 --- a/system/api/handlers.go +++ b/system/api/handlers.go @@ -323,6 +323,11 @@ func Record(next http.HandlerFunc) http.HandlerFunc { // Gzip wraps a HandlerFunc to compress responses when possible func Gzip(next http.HandlerFunc) http.HandlerFunc { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + if db.ConfigCache("gzip_disabled").(bool) == true { + next.ServeHTTP(res, req) + return + } + // check if req header content-encoding supports gzip if strings.Contains(req.Header.Get("Accept-Encoding"), "gzip") { // gzip response data @@ -330,7 +335,6 @@ func Gzip(next http.HandlerFunc) http.HandlerFunc { gzres := gzipResponseWriter{res, gzip.NewWriter(res)} next.ServeHTTP(gzres, req) - return } |