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

Function read_more

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

Source from the content-addressed store, hash-verified

173}
174
175async 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
194fn find_crlf(buf: &[u8], start: usize) -> Option<usize> {
195 buf.get(start..)?

Callers 1

Calls 2

lenMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected