mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Tweak the MIME comparison in EventSource
MIME parameters should not be inspected when checking for text/event-stream.
This commit is contained in:
parent
bec1c396de
commit
8611b0f8c4
1 changed files with 8 additions and 12 deletions
|
@ -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