mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 21:38:51 +08:00
prepare for zstd
This commit is contained in:
@@ -142,22 +142,20 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||
}
|
||||
}
|
||||
|
||||
if ext != ".gz" {
|
||||
if ext != ".gz" && ext != ".zst" {
|
||||
if n.IsCompressed() {
|
||||
if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
|
||||
if _, _, _, shouldResize := shouldResizeImages(ext, r); shouldResize {
|
||||
if n.Data, err = util.DecompressData(n.Data); err != nil {
|
||||
glog.V(0).Infoln("ungzip error:", err, r.URL.Path)
|
||||
}
|
||||
} else {
|
||||
if util.IsGzippedContent(n.Data) {
|
||||
w.Header().Set("Content-Encoding", "gzip")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if _, _, _, shouldResize := shouldResizeImages(ext, r); shouldResize {
|
||||
if n.Data, err = util.DecompressData(n.Data); err != nil {
|
||||
glog.V(0).Infoln("ungzip error:", err, r.URL.Path)
|
||||
}
|
||||
} else if strings.Contains(r.Header.Get("Accept-Encoding"), "zstd") && util.IsZstdContent(n.Data) {
|
||||
w.Header().Set("Content-Encoding", "zstd")
|
||||
} else if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") && util.IsGzippedContent(n.Data) {
|
||||
w.Header().Set("Content-Encoding", "gzip")
|
||||
} else {
|
||||
if n.Data, err = util.DecompressData(n.Data); err != nil {
|
||||
glog.V(0).Infoln("uncompress error:", err, r.URL.Path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user