mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-08-01 15:57:42 +08:00
Default more not to gzip since gzip can be done on client side.
This commit is contained in:
parent
46b8c4cc98
commit
264678c9b1
@ -8,7 +8,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
/*
|
||||
* Default more not to gzip since gzip can be done on client side.
|
||||
*/
|
||||
func IsGzippable(ext, mtype string) bool {
|
||||
if strings.HasPrefix(mtype, "text/"){
|
||||
return true
|
||||
}
|
||||
if ext == ".zip" {
|
||||
return false
|
||||
}
|
||||
@ -18,12 +24,26 @@ func IsGzippable(ext, mtype string) bool {
|
||||
if ext == ".gz" {
|
||||
return false
|
||||
}
|
||||
if strings.Index(mtype,"text/")==0 {
|
||||
if ext == ".pdf" {
|
||||
return true
|
||||
}
|
||||
if strings.Index(mtype,"application/")==0 {
|
||||
if ext == ".css" {
|
||||
return true
|
||||
}
|
||||
if ext == ".js" {
|
||||
return true
|
||||
}
|
||||
if ext == ".json" {
|
||||
return true
|
||||
}
|
||||
if strings.HasPrefix(mtype, "application/") {
|
||||
if strings.HasSuffix(mtype, "xml") {
|
||||
return true
|
||||
}
|
||||
if strings.HasSuffix(mtype, "script") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
func GzipData(input []byte) []byte {
|
||||
|
Loading…
Reference in New Issue
Block a user