fix(web_server): Handle extracting session_token from multiple cookies (#4271)

Replaces `headers().get("cookie)` with `headers().get_all("cookie")`
because Axum splits a single `Cookie: a; b; c` into 3 separate headers
each with a single value
This commit is contained in:
DawidPietrykowski 2025-07-28 10:22:08 +02:00 committed by GitHub
parent 25a684e094
commit f391a73731
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -46,7 +46,7 @@ pub fn should_use_https(
pub fn parse_cookies<T>(request: &Request<T>) -> HashMap<String, String> { pub fn parse_cookies<T>(request: &Request<T>) -> HashMap<String, String> {
let mut cookies = HashMap::new(); let mut cookies = HashMap::new();
if let Some(cookie_header) = request.headers().get("cookie") { for cookie_header in request.headers().get_all("cookie") {
if let Ok(cookie_str) = cookie_header.to_str() { if let Ok(cookie_str) = cookie_header.to_str() {
for cookie_part in cookie_str.split(';') { for cookie_part in cookie_str.split(';') {
if let Ok(cookie) = Cookie::parse(cookie_part.trim()) { if let Ok(cookie) = Cookie::parse(cookie_part.trim()) {