Skip to main content

validate_control_frame

Function validate_control_frame 

Source
pub fn validate_control_frame(text: &str) -> Result<(), Error>
Expand description

Refuses any outbound text frame the platform would not recognize as a control frame.

The platform’s failure mode for an unrecognized control frame is to type it into the shell (sharp edge 1, measured: {"type":"window_size",...} became literal keystrokes and a corrupted prompt). So the rule here is a strict allowlist of what the platform is measured to accept — exactly {"type":"resize","cols":<n>,"rows":<n>} — and anything else is refused client-side, where the failure is a sentence rather than garbage in someone’s terminal.