MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / read_more

Function read_more

crates/openshell-supervisor-network/src/l7/graphql.rs:521–538  ·  view source on GitHub ↗
(
    client: &mut C,
    raw: &mut Vec<u8>,
    max_body_bytes: usize,
)

Source from the content-addressed store, hash-verified

519}
520
521async 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
540fn find_crlf(buf: &[u8], start: usize) -> Option<usize> {
541 buf.get(start..)?

Callers 1

Calls 2

lenMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected