(
client: &mut C,
raw: &mut Vec<u8>,
max_body_bytes: usize,
)
| 173 | } |
| 174 | |
| 175 | async fn read_more<C: AsyncRead + Unpin>( |
| 176 | client: &mut C, |
| 177 | raw: &mut Vec<u8>, |
| 178 | max_body_bytes: usize, |
| 179 | ) -> Result<()> { |
| 180 | if raw.len() > max_body_bytes.saturating_mul(2).max(max_body_bytes) { |
| 181 | return Err(miette!( |
| 182 | "HTTP chunked request body exceeds inspection framing limit" |
| 183 | )); |
| 184 | } |
| 185 | let mut buf = [0u8; READ_BUF_SIZE]; |
| 186 | let n = client.read(&mut buf).await.into_diagnostic()?; |
| 187 | if n == 0 { |
| 188 | return Err(miette!("HTTP chunked body ended before terminator")); |
| 189 | } |
| 190 | raw.extend_from_slice(&buf[..n]); |
| 191 | Ok(()) |
| 192 | } |
| 193 | |
| 194 | fn find_crlf(buf: &[u8], start: usize) -> Option<usize> { |
| 195 | buf.get(start..)? |
no test coverage detected