in core/src/services/icloud/core.rs [277:307]
fn update(&mut self, resp: &Response<Buffer>) -> Result<()> {
if let Some(account_country) = parse_header_to_str(resp.headers(), ACCOUNT_COUNTRY_HEADER)?
{
self.data.account_country = Some(account_country.to_string());
}
if let Some(session_id) = parse_header_to_str(resp.headers(), SESSION_ID_HEADER)? {
self.data.session_id = Some(session_id.to_string());
}
if let Some(session_token) = parse_header_to_str(resp.headers(), SESSION_TOKEN_HEADER)? {
self.data.session_token = Some(session_token.to_string());
}
if let Some(scnt) = parse_header_to_str(resp.headers(), SCNT_HEADER)? {
self.data.scnt = Some(scnt.to_string());
}
let cookies: Vec<String> = resp
.headers()
.get_all(header::SET_COOKIE)
.iter()
.map(|v| v.to_str().unwrap().to_string())
.collect();
for cookie in cookies {
if let Some((key, value)) = cookie.split_once('=') {
self.data.cookies.insert(key.into(), value.into());
}
}
Ok(())
}