mirror of
https://github.com/servo/servo.git
synced 2025-06-25 17:44:33 +01:00
Only pass the headers to set_cookies_from_response.
I will need to call it from the fetch code, which does not have a HttpResponse on hand. Also, rename the function to match its new signature.
This commit is contained in:
parent
f34534740a
commit
2d430050a8
1 changed files with 3 additions and 3 deletions
|
@ -499,8 +499,8 @@ fn set_cookie_for_url(cookie_jar: &Arc<RwLock<CookieStorage>>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_cookies_from_response(url: &Url, response: &HttpResponse, cookie_jar: &Arc<RwLock<CookieStorage>>) {
|
fn set_cookies_from_headers(url: &Url, headers: &Headers, cookie_jar: &Arc<RwLock<CookieStorage>>) {
|
||||||
if let Some(cookies) = response.headers().get_raw("set-cookie") {
|
if let Some(cookies) = headers.get_raw("set-cookie") {
|
||||||
for cookie in cookies.iter() {
|
for cookie in cookies.iter() {
|
||||||
if let Ok(cookie_value) = String::from_utf8(cookie.clone()) {
|
if let Ok(cookie_value) = String::from_utf8(cookie.clone()) {
|
||||||
set_cookie_for_url(&cookie_jar,
|
set_cookie_for_url(&cookie_jar,
|
||||||
|
@ -731,7 +731,7 @@ pub fn process_response_headers(response: &HttpResponse,
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-http-network-fetch step 9
|
// https://fetch.spec.whatwg.org/#concept-http-network-fetch step 9
|
||||||
if load_data.credentials_flag {
|
if load_data.credentials_flag {
|
||||||
set_cookies_from_response(url, response, cookie_jar);
|
set_cookies_from_headers(url, response.headers(), cookie_jar);
|
||||||
}
|
}
|
||||||
update_sts_list_from_response(url, response, hsts_list);
|
update_sts_list_from_response(url, response, hsts_list);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue