提交 726d18fd 作者: Kevin Atkinson

urlstore: Accept "200 OK" in addition to "206 Partial Content".

Some servers seem to return 200 OK when range header covers entire
file.  If the content is wrong we will detect later so there is no
harm in accepting either response.

License: MIT
Signed-off-by: 's avatarKevin Atkinson <k@kevina.org>
上级 ec61e06c
......@@ -216,9 +216,9 @@ func (f *FileManager) readURLDataObj(c *cid.Cid, d *pb.DataObj) ([]byte, error)
if err != nil {
return nil, &CorruptReferenceError{StatusFileError, err}
}
if res.StatusCode != http.StatusPartialContent {
if res.StatusCode != http.StatusOK && res.StatusCode != http.StatusPartialContent {
return nil, &CorruptReferenceError{StatusFileError,
fmt.Errorf("expected HTTP 206 got %d", res.StatusCode)}
fmt.Errorf("expected HTTP 200 or 206 got %d", res.StatusCode)}
}
outbuf := make([]byte, d.GetSize_())
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论