Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions src/connmgr/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3657,14 +3657,10 @@ where
};

// First call can't fail
let (size, overflowed) = prepare_body
let size = prepare_body
.prepare(rdata.body, true)
.expect("infallible prepare call failed");

if overflowed > 0 {
debug!("server-conn {}: overflowing {} bytes", id, overflowed);
}

// We confirmed above that the data will fit in the buffer
assert!(size == rdata.body.len());

Expand Down Expand Up @@ -3780,14 +3776,10 @@ where
};

// First call can't fail
let (size, overflowed) = prepare_body
let size = prepare_body
.prepare(rdata.body, !rdata.more)
.expect("infallible prepare call failed");

if overflowed > 0 {
debug!("server-conn {}: overflowing {} bytes", id, overflowed);
}

// We confirmed above that the data will fit in the buffer
assert!(size == rdata.body.len());

Expand Down Expand Up @@ -3930,12 +3922,7 @@ where

match &zresp.get().ptype {
zhttppacket::ResponsePacket::Data(rdata) => {
let (size, overflowed) =
prepare_body.prepare(rdata.body, !rdata.more)?;

if overflowed > 0 {
debug!("server-conn {}: overflowing {} bytes", id, overflowed);
}
let size = prepare_body.prepare(rdata.body, !rdata.more)?;

if size < rdata.body.len() {
return Err(Error::BufferExceeded);
Expand Down
4 changes: 2 additions & 2 deletions src/core/http1/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ pub struct ResponsePrepareBody<'a, 'b, R: AsyncRead, W: AsyncWrite> {

impl<R: AsyncRead, W: AsyncWrite> ResponsePrepareBody<'_, '_, R, W> {
// Only returns an error on invalid input
pub fn prepare(&mut self, src: &[u8], end: bool) -> Result<(usize, usize), Error> {
pub fn prepare(&mut self, src: &[u8], end: bool) -> Result<usize, Error> {
let state = self.state.borrow();
let state = state.as_ref().unwrap();

Expand All @@ -589,7 +589,7 @@ impl<R: AsyncRead, W: AsyncWrite> ResponsePrepareBody<'_, '_, R, W> {
state.end.set(true);
}

Ok((size, 0))
Ok(size)
}
}

Expand Down
Loading