mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add Content Range Header and add one for blob end range (#34797)
Signed-off-by: rayguo17 <rayguo17@gmail.com>
This commit is contained in:
parent
faf30176f1
commit
55ac1887dc
6 changed files with 75 additions and 95 deletions
|
@ -109,6 +109,16 @@ impl RelativePos {
|
|||
end: (start + span).to_usize().unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
// Per <https://fetch.spec.whatwg.org/#concept-scheme-fetch> step 3.blob.14.8:
|
||||
// "A range header denotes an inclusive byte range, while the slice blob algorithm input range does not.
|
||||
// To use the slice blob algorithm, we have to increment rangeEnd."
|
||||
pub fn to_abs_blob_range(&self, size: usize) -> Range<usize> {
|
||||
let orig_range = self.to_abs_range(size);
|
||||
let start = orig_range.start;
|
||||
let end = usize::min(orig_range.end + 1, size);
|
||||
Range { start, end }
|
||||
}
|
||||
}
|
||||
|
||||
/// Response to file selection request
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue