Skip to content

Commit

Permalink
Fix consume not updated
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo committed Mar 11, 2024
1 parent f2a27aa commit ebeb269
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions core/src/raw/http_util/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,6 @@ impl IncomingAsyncBody {
}

impl oio::Read for IncomingAsyncBody {
async fn seek(&mut self, pos: io::SeekFrom) -> Result<u64> {
let _ = pos;

Err(Error::new(
ErrorKind::Unsupported,
"output reader doesn't support seeking",
))
}

async fn read(&mut self, size: usize) -> Result<Bytes> {
if self.size == Some(0) {
return Ok(Bytes::new());
Expand All @@ -191,7 +182,18 @@ impl oio::Read for IncomingAsyncBody {
};
}

let bs = self.chunk.split_to(min(size, self.chunk.len()));
let size = min(size, self.chunk.len());
self.consumed += size as u64;
let bs = self.chunk.split_to(size);
Ok(bs)
}

async fn seek(&mut self, pos: io::SeekFrom) -> Result<u64> {
let _ = pos;

Err(Error::new(
ErrorKind::Unsupported,
"output reader doesn't support seeking",
))
}
}

0 comments on commit ebeb269

Please sign in to comment.