|
@ -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(4).Infoln("response write error:", e) |
|
|
|
|
|
|
|
|
glog.V(2).Infoln("response write error:", e) |
|
|
} |
|
|
} |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -276,7 +276,7 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *storage.Needle, fileName string, |
|
|
if rangeReq == "" { |
|
|
if rangeReq == "" { |
|
|
w.Header().Set("Content-Length", strconv.FormatInt(chunkManifest.Size, 10)) |
|
|
w.Header().Set("Content-Length", strconv.FormatInt(chunkManifest.Size, 10)) |
|
|
if _, e = io.Copy(w, chunkedFileReader); e != nil { |
|
|
if _, e = io.Copy(w, chunkedFileReader); e != nil { |
|
|
glog.V(0).Infoln("response write error:", e) |
|
|
|
|
|
|
|
|
glog.V(2).Infoln("response write error:", e) |
|
|
} |
|
|
} |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
@ -317,10 +317,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("chunkedFileReader Seek error:", e) |
|
|
|
|
|
|
|
|
glog.V(2).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(4).Infoln("response write error:", e) |
|
|
|
|
|
|
|
|
glog.V(2).Infoln("response write error:", e) |
|
|
} |
|
|
} |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
@ -345,7 +345,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(4).Infoln("response write error:", e) |
|
|
|
|
|
|
|
|
glog.V(2).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) |
|
|