Minimal HTML attribute escaping for untrusted values. Escapes `&`, `"`, `'`, `<`, and `>` so the value is safe for embedding inside a quoted HTML attribute.
(s: &str)
| 385 | /// Escapes `&`, `"`, `'`, `<`, and `>` so the value is safe for embedding |
| 386 | /// inside a quoted HTML attribute. |
| 387 | fn html_escape(s: &str) -> String { |
| 388 | let mut out = String::with_capacity(s.len()); |
| 389 | for ch in s.chars() { |
| 390 | match ch { |
| 391 | '&' => out.push_str("&"), |
| 392 | '"' => out.push_str("""), |
| 393 | '\'' => out.push_str("'"), |
| 394 | '<' => out.push_str("<"), |
| 395 | '>' => out.push_str(">"), |
| 396 | c => out.push(c), |
| 397 | } |
| 398 | } |
| 399 | out |
| 400 | } |
| 401 | |
| 402 | /// Render a waiting page shown when the edge proxy auth cookie is not yet present. |
| 403 | /// |
no test coverage detected