support gzip file upload, fix problem during replication of gzipped data

This commit is contained in:
Chris Lu
2013-07-15 11:04:43 -07:00
parent c6bd4e656e
commit 70fe7e6b5d
4 changed files with 11 additions and 5 deletions

View File

@@ -4,8 +4,8 @@ import (
"code.google.com/p/weed-fs/go/util"
"encoding/hex"
"errors"
"log"
"io/ioutil"
"log"
"mime"
"net/http"
"path"
@@ -73,7 +73,9 @@ func NewNeedle(r *http.Request) (n *Needle, e error) {
n.SetHasMime()
mtype = contentType
}
if IsGzippable(ext, mtype) {
if part.Header.Get("Content-Encoding") == "gzip" {
n.SetGzipped()
} else if IsGzippable(ext, mtype) {
if data, e = GzipData(data); e != nil {
return
}