mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
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:
commit
b1a4913b3f
6 changed files with 17 additions and 37 deletions
|
@ -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"}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue