(
client: &mut C,
raw: &mut Vec<u8>,
max_body_bytes: usize,
)
| 519 | } |
| 520 | |
| 521 | async fn read_more<C: AsyncRead + Unpin>( |
| 522 | client: &mut C, |
| 523 | raw: &mut Vec<u8>, |
| 524 | max_body_bytes: usize, |
| 525 | ) -> Result<()> { |
| 526 | if raw.len() > max_body_bytes.saturating_mul(2).max(max_body_bytes) { |
| 527 | return Err(miette!( |
| 528 | "GraphQL chunked request body exceeds inspection framing limit" |
| 529 | )); |
| 530 | } |
| 531 | let mut buf = [0u8; 8192]; |
| 532 | let n = client.read(&mut buf).await.into_diagnostic()?; |
| 533 | if n == 0 { |
| 534 | return Err(miette!("GraphQL chunked body ended before terminator")); |
| 535 | } |
| 536 | raw.extend_from_slice(&buf[..n]); |
| 537 | Ok(()) |
| 538 | } |
| 539 | |
| 540 | fn find_crlf(buf: &[u8], start: usize) -> Option<usize> { |
| 541 | buf.get(start..)? |
no test coverage detected