[domistream] Host HTTP: strict request head and query parsing into typed routes, XML answers the client parsers accept (head-end test corrected: a 64 KiB buffer without the empty line is already over the cap)

This commit is contained in:
2026-12-04 12:30:29 +01:00
parent befcd7320a
commit 2ba0926cd6
4 changed files with 527 additions and 54 deletions
+2 -2
View File
@@ -142,7 +142,7 @@ fn pair_requests_refused() {
(format!("uniqueid={UID}&clientchallenge=00&serverchallengeresp=00"), "two phases"),
(format!("uniqueid={UID}&clientchallenge="), "empty hex"),
(format!("uniqueid={UID}&clientchallenge=0x00"), "0x prefix"),
(format!("uniqueid=a%26b&phrase=pairchallenge"), "bad uniqueid"),
("uniqueid=a%26b&phrase=pairchallenge".to_string(), "bad uniqueid"),
(format!("uniqueid={}&phrase=pairchallenge", "a".repeat(65)), "long uniqueid"),
(format!("uniqueid={UID}&uniqueid={UID}&phrase=pairchallenge"), "repeated uniqueid"),
(format!("uniqueid={UID}&phrase=pairchallenge&phrase=getservercert"), "repeated phrase"),
@@ -393,7 +393,7 @@ fn find_head_end_cuts_the_stream() {
at_cap.extend_from_slice(b"\r\n\r\n");
assert_eq!(find_head_end(&at_cap), Ok(Some(MAX_HEAD_BYTES)));
assert_eq!(find_head_end(&vec![b'a'; MAX_HEAD_BYTES - 1]), Ok(None), "could still end within the cap");
let mut almost = vec![b'a'; MAX_HEAD_BYTES - 3];
let mut almost = vec![b'a'; MAX_HEAD_BYTES - 4];
almost.extend_from_slice(b"\r\n\r");
assert_eq!(find_head_end(&almost), Ok(None), "one more LF ends it exactly at the cap");
for len in [MAX_HEAD_BYTES, MAX_HEAD_BYTES + 1, 1 << 22] {