Commit 726d18fd authored by Kevin Atkinson's avatar 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: default avatarKevin Atkinson <k@kevina.org>
parent 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 is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment