remove dead code and handle mutli-range by sending whole file
All checks were successful
continuous-integration/drone/pr Build is passing

This commit is contained in:
Trinity Pointard 2021-11-25 18:30:33 +01:00
parent 8c45ad8e38
commit 991279cd40

View file

@ -158,9 +158,9 @@ pub async fn handle_get(
let range_str = range.to_str()?; let range_str = range.to_str()?;
let mut ranges = http_range::HttpRange::parse(range_str, last_v_meta.size)?; let mut ranges = http_range::HttpRange::parse(range_str, last_v_meta.size)?;
if ranges.len() > 1 { if ranges.len() > 1 {
return Err(Error::BadRequest( // garage does not support multi-range requests yet, so we respond with the entire
"Multiple ranges not supported".to_string(), // object when multiple ranges are requested
)); None
} else { } else {
ranges.pop() ranges.pop()
} }
@ -235,10 +235,6 @@ async fn handle_get_range(
begin: u64, begin: u64,
end: u64, end: u64,
) -> Result<Response<Body>, Error> { ) -> Result<Response<Body>, Error> {
if end > version_meta.size {
return Err(Error::BadRequest("Range not included in file".to_string()));
}
let resp_builder = object_headers(version, version_meta) let resp_builder = object_headers(version, version_meta)
.header("Content-Length", format!("{}", end - begin)) .header("Content-Length", format!("{}", end - begin))
.header( .header(