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

Function rejects_v1_without_terminator

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

Source from the content-addressed store, hash-verified

248
249 #[tokio::test]
250 async fn rejects_v1_without_terminator() {
251 // PROXY prefix matched but no \r\n terminator within V1_MAX_LENGTH bytes.
252 let bytes = vec![b'P'; V1_MAX_LENGTH + 8]; // all 'P' — never closes
253 let mut head = b"PROXY".to_vec();
254 head.extend(std::iter::repeat(b'A').take(V1_MAX_LENGTH));
255 let err = read_proxy_header(&head[..]).await.unwrap_err();
256 let msg = format!("{err:#}");
257 assert!(
258 msg.contains("v1 terminator not found") || msg.contains("no valid proxy"),
259 "unexpected error: {msg}"
260 );
261 // Sanity: the longer no-terminator buffer would also fail (read past)
262 let _ = bytes;
263 }
264
265 #[tokio::test]
266 async fn rejects_v2_oversize_length() {

Callers

nothing calls this directly

Calls 2

read_proxy_headerFunction · 0.85
to_vecMethod · 0.80

Tested by

no test coverage detected