I know how to set a Cookie:
It used to be possible to do it like this:
let mut cookie = CookiePair::new(String::from("session"),
session.get_id_str().to_owned());
cookie.expires = Some(time::now_utc() + CONFIG.get_session_remember());
res.headers.set(SetCookie(vec![cookie]));
Session is our own internal library.
But I upgraded to the newest version of iron(and other libraries) and now get the error:
Use of undeclared type or module `CookiePair`
Even though I am doing the same import as before:
use iron::headers::{Cookie, SetCookie, Location}
I tried importing CookiePair in hyper instead:
unresolved import `hyper::header::CookiePair`
Now when I try this:
let mut cookie = Cookie(vec![format!("session={}", session.get_id_str())]);
cookie.expires = Some(time::now_utc() + CONFIG.get_session_remember());
I get an error:
no field expires
on type iron::header::Cookie
And I can't seem to set 'expires' on the cookie.. which being a high security website, I need. Point being.. I'm trying but can't figure this one out. Can someone please help?
Thanks!