Browse Source

update

pull/224/head
tnextday 9 years ago
parent
commit
520875d455
  1. 2
      go/operation/submit.go
  2. 10
      go/weed/weed_server/volume_server_handlers_read.go

2
go/operation/submit.go

@ -190,6 +190,6 @@ func upload_chunked_file_manifest(fileUrl string, manifest *ChunkManifest, jwt s
q := u.Query() q := u.Query()
q.Set("cm", "1") q.Set("cm", "1")
u.RawQuery = q.Encode() u.RawQuery = q.Encode()
_, e = Upload(u.String(), manifest.Name, bufReader, false, "text/plain", jwt)
_, e = Upload(u.String(), manifest.Name, bufReader, false, "application/json", jwt)
return e return e
} }

10
go/weed/weed_server/volume_server_handlers_read.go

@ -140,7 +140,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
if rangeReq == "" { if rangeReq == "" {
w.Header().Set("Content-Length", strconv.Itoa(len(n.Data))) w.Header().Set("Content-Length", strconv.Itoa(len(n.Data)))
if _, e = w.Write(n.Data); e != nil { if _, e = w.Write(n.Data); e != nil {
glog.V(0).Infoln("response write error:", e)
glog.V(4).Infoln("response write error:", e)
} }
return return
} }
@ -181,7 +181,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
w.Header().Set("Content-Range", ra.contentRange(size)) w.Header().Set("Content-Range", ra.contentRange(size))
w.WriteHeader(http.StatusPartialContent) w.WriteHeader(http.StatusPartialContent)
if _, e = w.Write(n.Data[ra.start : ra.start+ra.length]); e != nil { if _, e = w.Write(n.Data[ra.start : ra.start+ra.length]); e != nil {
glog.V(0).Infoln("response write error:", e)
glog.V(4).Infoln("response write error:", e)
} }
return return
} }
@ -324,10 +324,10 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *storage.Needle, fileName string,
w.Header().Set("Content-Range", ra.contentRange(size)) w.Header().Set("Content-Range", ra.contentRange(size))
w.WriteHeader(http.StatusPartialContent) w.WriteHeader(http.StatusPartialContent)
if _, e = chunkedFileReader.Seek(ra.start, 0); e != nil { if _, e = chunkedFileReader.Seek(ra.start, 0); e != nil {
glog.V(0).Infoln("response write error:", e)
glog.V(0).Infoln("chunkedFileReader Seek error:", e)
} }
if _, e = io.CopyN(w, chunkedFileReader, ra.length); e != nil { if _, e = io.CopyN(w, chunkedFileReader, ra.length); e != nil {
glog.V(0).Infoln("response write error:", e)
glog.V(4).Infoln("response write error:", e)
} }
return return
} }
@ -352,7 +352,7 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *storage.Needle, fileName string,
return return
} }
if _, e = chunkedFileReader.Seek(ra.start, 0); e != nil { if _, e = chunkedFileReader.Seek(ra.start, 0); e != nil {
glog.V(0).Infoln("response write error:", e)
glog.V(4).Infoln("response write error:", e)
} }
if _, err = io.CopyN(part, chunkedFileReader, ra.length); err != nil { if _, err = io.CopyN(part, chunkedFileReader, ra.length); err != nil {
pw.CloseWithError(err) pw.CloseWithError(err)

Loading…
Cancel
Save