MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / rejects_v2_oversize_length

Function rejects_v2_oversize_length

gateway/src/pp.rs:266–278  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

264
265 #[tokio::test]
266 async fn rejects_v2_oversize_length() {
267 // v2 prefix with a length field exceeding V2_MAX_LENGTH.
268 let mut header = Vec::new();
269 header.extend_from_slice(V2_PROTOCOL_PREFIX);
270 header.extend_from_slice(&[0x21, 0x11]);
271 // length = V2_MAX_LENGTH bytes -> total = MIN + that, blows the cap
272 header.extend_from_slice(&(V2_MAX_LENGTH as u16).to_be_bytes());
273 let err = read_proxy_header(&header[..]).await.unwrap_err();
274 assert!(
275 format!("{err:#}").contains("too long"),
276 "unexpected error: {err:#}"
277 );
278 }
279
280 #[test]
281 fn synthesizes_unspec_when_no_addrs() {

Callers

nothing calls this directly

Calls 1

read_proxy_headerFunction · 0.85

Tested by

no test coverage detected