Extract a named cookie value from a `Cookie` header string.
(cookies: &str, name: &str)
| 142 | |
| 143 | /// Extract a named cookie value from a `Cookie` header string. |
| 144 | fn extract_cookie(cookies: &str, name: &str) -> Option<String> { |
| 145 | cookies.split(';').find_map(|c| { |
| 146 | let mut parts = c.trim().splitn(2, '='); |
| 147 | let key = parts.next()?.trim(); |
| 148 | let val = parts.next()?.trim(); |
| 149 | if key == name { |
| 150 | Some(val.to_string()) |
| 151 | } else { |
| 152 | None |
| 153 | } |
| 154 | }) |
| 155 | } |
| 156 | |
| 157 | /// Render the styled confirmation page with the edge auth token embedded. |
| 158 | /// |