From 486ecd1de3d70215bacb1541b69e13b7d5107d1e Mon Sep 17 00:00:00 2001 From: Eshan Chatterjee Date: Mon, 8 Apr 2024 17:13:18 +0530 Subject: [PATCH] fix extract_cookie function to handle grpc cookies in the header --- server/src/handlers/livetail.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/server/src/handlers/livetail.rs b/server/src/handlers/livetail.rs index de9970a1e..9289cb2a3 100644 --- a/server/src/handlers/livetail.rs +++ b/server/src/handlers/livetail.rs @@ -264,13 +264,17 @@ fn extract_basic_auth(header: &MetadataMap) -> Option { } fn extract_cookie(header: &MetadataMap) -> Option { - let cookies = header - .get("Cookie") - .and_then(|value| value.to_str().ok()) - .map(Cookie::split_parse)?; + // extract the cookie from the request + let cookies = header.get_all("cookie"); + let cookies: Vec<_> = cookies + .iter() + .filter_map(|value| value.to_str().ok()) + .flat_map(Cookie::split_parse) + .map(|value| value.unwrap()) + .collect(); cookies - .flatten() + .into_iter() .find(|cookie| cookie.name() == SESSION_COOKIE_NAME) }