Auto merge of #19350 - gterzian:ignore_aborted_responses_in_caching, r=jdm

Ignore aborted responses in caching

<!-- Please describe your changes on the following line: -->
@jdm @KiChjang @Manishearth Follow up on https://github.com/servo/servo/pull/18676 and https://github.com/servo/servo/pull/19274 to ignore aborted responses in caching.

I also found out the cache shouldn't return any response whose body is still in `ResponseBody::Receiving` mode, because that fails the assertion at https://github.com/servo/servo/blob/master/components/net/fetch/methods.rs#L438(we might want to add a channel as pat of the cached response later on to deal with this case). I only found out now because I needed the response from the server to trickle in so that it could be cached and aborted.

I copied the `http-cache.py` server from the wpt folder, and added a 'trickle' option, which is necessary to actually have a failing test with a cached but aborted request, it's now passing.

I also remove one unused import that slippled through previously.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19350)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-01-23 14:47:16 -06:00 committed by GitHub
commit 4307b6e67b
9 changed files with 236 additions and 25 deletions

View file

@ -12478,6 +12478,11 @@
{}
]
],
"mozilla/resources/http-cache-trickle.py": [
[
{}
]
],
"mozilla/resources/http-cache.js": [
[
{}
@ -33251,6 +33256,12 @@
{}
]
],
"mozilla/http-cache-xhr.html": [
[
"/_mozilla/mozilla/http-cache-xhr.html",
{}
]
],
"mozilla/http-cache.html": [
[
"/_mozilla/mozilla/http-cache.html",
@ -66358,6 +66369,10 @@
"592f69ee432ba5bc7a2f2649e72e083d21393496",
"testharness"
],
"mozilla/http-cache-xhr.html": [
"d4747fdc9ec6acc50718c13a668451987a44d219",
"testharness"
],
"mozilla/http-cache.html": [
"33827dc9bdb0efcbcae4f730086693be315cfc14",
"testharness"
@ -72034,8 +72049,12 @@
"78686147f85e4146e7fc58c1f67a613f65b099a2",
"support"
],
"mozilla/resources/http-cache-trickle.py": [
"48f4e32ec2e1c1b6d47e89254045b398c1d84d40",
"support"
],
"mozilla/resources/http-cache.js": [
"c6b1ee9def26d4e12a1b93e551c225f82b4717c2",
"4bf71e1f328e778990eb756741a3be58f4f57ef6",
"support"
],
"mozilla/resources/iframe_contentDocument_inner.html": [