Skip to content

Commit

Permalink
Make end inclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Jun 2, 2019
1 parent aa990d3 commit 9f4c2bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/lib/src/response/responder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ impl<'r, B: io::Seek + io::Read + 'r> Responder<'r> for RangeResponder<B> {

let (start, end) = match ranges[0] {
ByteRangeSpec::FromTo(mut start, mut end) => {
// make end exclusive
end += 1;
if end > size {
end = size;
}
Expand Down Expand Up @@ -304,7 +306,8 @@ impl<'r, B: io::Seek + io::Read + 'r> Responder<'r> for RangeResponder<B> {
.status(Status::PartialContent)
.header(AcceptRanges(vec![RangeUnit::Bytes]))
.header(ContentRange(ContentRangeSpec::Bytes {
range: Some((start, end)),
// make end inclusive again
range: Some((start, end - 1)),
instance_length: Some(size),
}))
.raw_body(Body::Sized(body, end - start))
Expand Down

0 comments on commit 9f4c2bb

Please sign in to comment.