mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Redesign CookieStorage and Implement Leave Secure Cookie Alone
CookieStorage has been refactored to use HashMap with base domain as the key. Values of hashmap is vector of cookies. CookieStorage now has max_per_host which restricts maximum cookies that can be added per base domain. Cookie eviction doesnot take place if max_per_host is not reached. Cookie eviction logic implemented here does following steps 1) Evict all expired cookies 2) Remove oldest accessed non-secure cookie If any 3) When no non-secure cookie exist, remove oldest accessed secure cookie if new cookie being added is secure. Else ignore new cookie
This commit is contained in:
parent
7c346e0d94
commit
c1518adba8
5 changed files with 195 additions and 21 deletions
|
@ -185,7 +185,7 @@ fn create_resource_groups(config_dir: Option<&Path>)
|
|||
-> (ResourceGroup, ResourceGroup) {
|
||||
let mut hsts_list = HstsList::from_servo_preload();
|
||||
let mut auth_cache = AuthCache::new();
|
||||
let mut cookie_jar = CookieStorage::new();
|
||||
let mut cookie_jar = CookieStorage::new(150);
|
||||
if let Some(config_dir) = config_dir {
|
||||
read_json_from_file(&mut auth_cache, config_dir, "auth_cache.json");
|
||||
read_json_from_file(&mut hsts_list, config_dir, "hsts_list.json");
|
||||
|
@ -198,7 +198,7 @@ fn create_resource_groups(config_dir: Option<&Path>)
|
|||
connector: create_http_connector(),
|
||||
};
|
||||
let private_resource_group = ResourceGroup {
|
||||
cookie_jar: Arc::new(RwLock::new(CookieStorage::new())),
|
||||
cookie_jar: Arc::new(RwLock::new(CookieStorage::new(150))),
|
||||
auth_cache: Arc::new(RwLock::new(AuthCache::new())),
|
||||
hsts_list: Arc::new(RwLock::new(HstsList::new())),
|
||||
connector: create_http_connector(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue