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

Function format_chunk

crates/openshell-supervisor-network/src/l7/inference.rs:454–459  ·  view source on GitHub ↗

Format a single HTTP chunked transfer-encoding segment. Returns ` \r\n \r\n`.

(data: &[u8])

Source from the content-addressed store, hash-verified

452///
453/// Returns `<hex-length>\r\n<data>\r\n`.
454pub fn format_chunk(data: &[u8]) -> Vec<u8> {
455 let mut buf = format!("{:x}\r\n", data.len()).into_bytes();
456 buf.extend_from_slice(data);
457 buf.extend_from_slice(b"\r\n");
458 buf
459}
460
461/// The HTTP chunked transfer-encoding terminator: `0\r\n\r\n`.
462pub fn format_chunk_terminator() -> &'static [u8] {

Callers 5

route_inference_requestFunction · 0.85
format_chunk_basicFunction · 0.85
format_chunk_emptyFunction · 0.85
format_chunk_large_hexFunction · 0.85

Calls

no outgoing calls

Tested by 3

format_chunk_basicFunction · 0.68
format_chunk_emptyFunction · 0.68
format_chunk_large_hexFunction · 0.68