Auto merge of #22678 - nox:mime, r=SimonSapin

Pull mime 0.3.13 and fix a MIME comparison in EventSource

<!-- 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/22678)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-01-14 08:48:00 -05:00 committed by GitHub
commit b1a4913b3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 37 deletions

View file

@ -71,7 +71,7 @@ malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = "0.1"
metrics = {path = "../metrics"}
mitochondria = "1.1.2"
mime = "0.3"
mime = "0.3.13"
mime_guess = "2.0.0-alpha.6"
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}

View file

@ -344,19 +344,15 @@ impl FetchResponseListener for EventSourceContext {
FetchMetadata::Unfiltered(m) => m,
FetchMetadata::Filtered { unsafe_, .. } => unsafe_,
};
match meta.content_type {
None => self.fail_the_connection(),
Some(ct) => {
if <ContentType as Into<Mime>>::into(ct.into_inner()) ==
mime::TEXT_EVENT_STREAM
{
self.origin = meta.final_url.origin().ascii_serialization();
self.announce_the_connection();
} else {
self.fail_the_connection()
}
},
let mime = match meta.content_type {
None => return self.fail_the_connection(),
Some(ct) => <ContentType as Into<Mime>>::into(ct.into_inner()),
};
if (mime.type_(), mime.subtype()) != (mime::TEXT, mime::EVENT_STREAM) {
return self.fail_the_connection();
}
self.origin = meta.final_url.origin().ascii_serialization();
self.announce_the_connection();
},
Err(_) => {
self.reestablish_the_connection();