MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / extract_cookie

Function extract_cookie

crates/openshell-server/src/auth/http.rs:144–155  ·  view source on GitHub ↗

Extract a named cookie value from a `Cookie` header string.

(cookies: &str, name: &str)

Source from the content-addressed store, hash-verified

142
143/// Extract a named cookie value from a `Cookie` header string.
144fn 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///

Callers 1

auth_connectFunction · 0.70

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected