aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/cookie_storage.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-05-17 16:34:16 -0700
committerbors-servo <lbergstrom+bors@mozilla.com>2016-05-17 16:34:16 -0700
commitc519739b7bcf408f2f671a89729aa30f39dd67a1 (patch)
treec116579a6acc8b830304cad80e12d39f2f09aae3 /components/net/cookie_storage.rs
parent6c08ad857ea4139bb266c481eebe4315bdd460d5 (diff)
parent4fb53c8256fc5b770255b47d9b60cdc540b9838b (diff)
downloadservo-c519739b7bcf408f2f671a89729aa30f39dd67a1.tar.gz
servo-c519739b7bcf408f2f671a89729aa30f39dd67a1.zip
Auto merge of #11196 - fduraffourg:master, r=jdm
Add unit tests for cookies handling Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #9965 Either: - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ Add unit tests for the `net` component about cookies. The tests are generated with a new `mach update-net-cookies` command from this repo: https://github.com/abarth/http-state. This PR also includes two trivial bug fixes about cookie handling. From all the tests included, the following ones are currently failing: - cookie_http_state::test_0003 - cookie_http_state::test_0006 - cookie_http_state::test_attribute0004 - cookie_http_state::test_attribute0005 - cookie_http_state::test_attribute0007 - cookie_http_state::test_attribute0008 - cookie_http_state::test_domain0017 - cookie_http_state::test_mozilla0001 - cookie_http_state::test_mozilla0002 - cookie_http_state::test_mozilla0003 - cookie_http_state::test_mozilla0005 - cookie_http_state::test_mozilla0007 - cookie_http_state::test_mozilla0009 - cookie_http_state::test_mozilla0010 - cookie_http_state::test_mozilla0013 `test_000[36]` and `test_mozilla*` are failing because there is currently no method to clean a `net::cookie_storage` from expired cookies. `test_attribute000[4578]` are failing because hyper does not parse the `Secure` attribute correctly. I will open an issue on the upstream project. `test_domain0017` fails because the TLD .org is not on the PUB_DOMAINS list. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11196) <!-- Reviewable:end -->
Diffstat (limited to 'components/net/cookie_storage.rs')
-rw-r--r--components/net/cookie_storage.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/components/net/cookie_storage.rs b/components/net/cookie_storage.rs
index 76c940d8863..19a14b40564 100644
--- a/components/net/cookie_storage.rs
+++ b/components/net/cookie_storage.rs
@@ -57,10 +57,6 @@ impl CookieStorage {
return;
}
- if cookie.cookie.value.is_empty() {
- return;
- }
-
// Step 11
if let Some(old_cookie) = old_cookie.unwrap() {
// Step 11.3
@@ -107,7 +103,7 @@ impl CookieStorage {
// Step 4
(match acc.len() {
0 => acc,
- _ => acc + ";"
+ _ => acc + "; "
}) + &c.cookie.name + "=" + &c.cookie.value
};
let result = url_cookies.iter_mut().fold("".to_owned(), reducer);