From 963082557600373230a32d0247fb29d746aface4 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 23 Oct 2012 10:59:40 -0700 Subject: [PATCH] adjusting gzip logic --- weed-fs/src/cmd/weed/volume.go | 2 +- weed-fs/src/pkg/storage/compress.go | 6 +++--- weed-fs/src/pkg/storage/needle.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/weed-fs/src/cmd/weed/volume.go b/weed-fs/src/cmd/weed/volume.go index 9696ffc85..259dbfded 100644 --- a/weed-fs/src/cmd/weed/volume.go +++ b/weed-fs/src/cmd/weed/volume.go @@ -105,7 +105,7 @@ func GetHandler(w http.ResponseWriter, r *http.Request) { if ext != "" { mtype := mime.TypeByExtension(ext) w.Header().Set("Content-Type", mtype) - if storage.IsCompressable(ext, mtype) { + if storage.IsGzippable(ext, mtype) { if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") { w.Header().Set("Content-Encoding", "gzip") } else { diff --git a/weed-fs/src/pkg/storage/compress.go b/weed-fs/src/pkg/storage/compress.go index d441db009..2de547869 100644 --- a/weed-fs/src/pkg/storage/compress.go +++ b/weed-fs/src/pkg/storage/compress.go @@ -8,12 +8,12 @@ import ( "strings" ) -func IsCompressable(ext, mtype string) bool { +func IsGzippable(ext, mtype string) bool { if ext == ".zip" { - return true + return false } if ext == ".rar" { - return true + return false } if strings.Index(mtype,"text/")==0 { return true diff --git a/weed-fs/src/pkg/storage/needle.go b/weed-fs/src/pkg/storage/needle.go index 8f3a26ee6..e352eb55d 100644 --- a/weed-fs/src/pkg/storage/needle.go +++ b/weed-fs/src/pkg/storage/needle.go @@ -40,7 +40,7 @@ func NewNeedle(r *http.Request) (n *Needle, fname string, e error) { if dotIndex > 0 { ext := fname[dotIndex:] mtype := mime.TypeByExtension(ext) - if IsCompressable(ext, mtype) { + if IsGzippable(ext, mtype) { data = GzipData(data) } }