@@ -1252,17 +1252,20 @@ pub fn get_all_session_cookies(session_id: &str) -> Result<Vec<SessionCookieInfo
12521252
12531253 Ok ( jar
12541254 . get_all ( )
1255+ // wreq's wrapper only answers "is it Lax?" and "is it Strict?", which cannot tell
1256+ // `SameSite=None` apart from an absent attribute. The raw cookie reports the attribute
1257+ // itself.
1258+ . map ( cookie:: Cookie :: from)
12551259 . map ( |cookie| {
1256- let same_site = if cookie. same_site_lax ( ) {
1257- Some ( "lax" . to_owned ( ) )
1258- } else if cookie. same_site_strict ( ) {
1259- Some ( "strict" . to_owned ( ) )
1260- } else {
1261- None
1262- } ;
1260+ let same_site = cookie. same_site ( ) . map ( |same_site| match same_site {
1261+ cookie:: SameSite :: Lax => "lax" . to_owned ( ) ,
1262+ cookie:: SameSite :: Strict => "strict" . to_owned ( ) ,
1263+ cookie:: SameSite :: None => "none" . to_owned ( ) ,
1264+ } ) ;
12631265
12641266 let expires_at_ms = cookie
1265- . expires ( )
1267+ . expires_datetime ( )
1268+ . map ( std:: time:: SystemTime :: from)
12661269 . and_then ( |expires| expires. duration_since ( std:: time:: UNIX_EPOCH ) . ok ( ) )
12671270 . map ( |duration| duration. as_millis ( ) as f64 ) ;
12681271
@@ -1271,8 +1274,8 @@ pub fn get_all_session_cookies(session_id: &str) -> Result<Vec<SessionCookieInfo
12711274 value : cookie. value ( ) . to_owned ( ) ,
12721275 domain : cookie. domain ( ) . map ( ToOwned :: to_owned) ,
12731276 path : cookie. path ( ) . map ( ToOwned :: to_owned) ,
1274- secure : cookie. secure ( ) ,
1275- http_only : cookie. http_only ( ) ,
1277+ secure : cookie. secure ( ) . unwrap_or ( false ) ,
1278+ http_only : cookie. http_only ( ) . unwrap_or ( false ) ,
12761279 same_site,
12771280 expires_at_ms,
12781281 }
0 commit comments