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

Function rebuild_request

crates/openshell-supervisor-network/src/sigv4.rs:227–249  ·  view source on GitHub ↗
(
    parts: &RequestParts<'_>,
    instructions: &aws_sigv4::http_request::SigningInstructions,
    body: &[u8],
)

Source from the content-addressed store, hash-verified

225}
226
227fn rebuild_request(
228 parts: &RequestParts<'_>,
229 instructions: &aws_sigv4::http_request::SigningInstructions,
230 body: &[u8],
231) -> Vec<u8> {
232 let mut output = Vec::with_capacity(256 + body.len());
233
234 output.extend_from_slice(parts.request_line.as_bytes());
235 output.extend_from_slice(b"\r\n");
236
237 for (k, v) in &parts.all_headers {
238 output.extend_from_slice(format!("{k}: {v}\r\n").as_bytes());
239 }
240
241 for (name, value) in instructions.headers() {
242 output.extend_from_slice(format!("{name}: {value}\r\n").as_bytes());
243 }
244
245 output.extend_from_slice(b"\r\n");
246 output.extend_from_slice(body);
247
248 output
249}
250
251/// Apply AWS Signature Version 4 signing to a raw HTTP request buffer.
252///

Callers 2

apply_sigv4_to_requestFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected