adding compressiong support!

git-svn-id: https://weed-fs.googlecode.com/svn/trunk@59 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
chris.lu@gmail.com
2012-07-30 08:36:25 +00:00
parent 2e1ffa189b
commit f3a4125ee7
3 changed files with 53 additions and 3 deletions

View File

@@ -62,7 +62,11 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
return
}
if ext != "" {
w.Header().Set("Content-Type", mime.TypeByExtension(ext))
mtype := mime.TypeByExtension(ext)
w.Header().Set("Content-Type", mtype)
if storage.IsCompressable(ext, mtype){
w.Header().Set("Content-Encoding", "gzip")
}
}
w.Write(n.Data)
}