mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Fix capitalization for enum variants.
This commit is contained in:
parent
9d3fc76463
commit
349e01f6eb
3 changed files with 30 additions and 30 deletions
|
@ -24,8 +24,8 @@ pub enum MediaType {
|
|||
}
|
||||
|
||||
pub enum ApacheBugFlag {
|
||||
ON,
|
||||
OFF
|
||||
On,
|
||||
Off
|
||||
}
|
||||
|
||||
impl ApacheBugFlag {
|
||||
|
@ -35,17 +35,17 @@ impl ApacheBugFlag {
|
|||
|| last_raw_content_type == b"text/plain; charset=ISO-8859-1"
|
||||
|| last_raw_content_type == b"text/plain; charset=iso-8859-1"
|
||||
|| last_raw_content_type == b"text/plain; charset=UTF-8" {
|
||||
ApacheBugFlag::ON
|
||||
ApacheBugFlag::On
|
||||
} else {
|
||||
ApacheBugFlag::OFF
|
||||
ApacheBugFlag::Off
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum NoSniffFlag {
|
||||
ON,
|
||||
OFF
|
||||
On,
|
||||
Off
|
||||
}
|
||||
|
||||
pub type MimeType = (String, String);
|
||||
|
@ -70,10 +70,10 @@ impl MimeClassifier {
|
|||
self.sniff_unknown_type(no_sniff_flag, data)
|
||||
} else {
|
||||
match no_sniff_flag {
|
||||
NoSniffFlag::ON => supplied_type.clone(),
|
||||
NoSniffFlag::OFF => match apache_bug_flag {
|
||||
ApacheBugFlag::ON => self.sniff_text_or_data(data),
|
||||
ApacheBugFlag::OFF => match MimeClassifier::get_media_type(media_type,
|
||||
NoSniffFlag::On => supplied_type.clone(),
|
||||
NoSniffFlag::Off => match apache_bug_flag {
|
||||
ApacheBugFlag::On => self.sniff_text_or_data(data),
|
||||
ApacheBugFlag::Off => match MimeClassifier::get_media_type(media_type,
|
||||
media_subtype) {
|
||||
Some(MediaType::Html) => self.feeds_classifier.classify(data),
|
||||
Some(MediaType::Image) => self.image_classifier.classify(data),
|
||||
|
@ -180,7 +180,7 @@ impl MimeClassifier {
|
|||
|
||||
//some sort of iterator over the classifiers might be better?
|
||||
fn sniff_unknown_type(&self, no_sniff_flag: NoSniffFlag, data: &[u8]) -> MimeType {
|
||||
let should_sniff_scriptable = no_sniff_flag == NoSniffFlag::OFF;
|
||||
let should_sniff_scriptable = no_sniff_flag == NoSniffFlag::Off;
|
||||
let sniffed = if should_sniff_scriptable {
|
||||
self.scriptable_classifier.classify(data)
|
||||
} else {
|
||||
|
|
|
@ -101,8 +101,8 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
|||
-> Result<ProgressSender, ()> {
|
||||
if PREFS.get("network.mime.sniff").as_boolean().unwrap_or(false) {
|
||||
// TODO: should be calculated in the resource loader, from pull requeset #4094
|
||||
let mut no_sniff = NoSniffFlag::OFF;
|
||||
let mut check_for_apache_bug = ApacheBugFlag::OFF;
|
||||
let mut no_sniff = NoSniffFlag::Off;
|
||||
let mut check_for_apache_bug = ApacheBugFlag::Off;
|
||||
|
||||
if let Some(ref headers) = metadata.headers {
|
||||
if let Some(ref content_type) = headers.get_raw("content-type").and_then(|c| c.last()) {
|
||||
|
@ -110,7 +110,7 @@ pub fn start_sending_sniffed_opt(start_chan: LoadConsumer, mut metadata: Metadat
|
|||
}
|
||||
if let Some(ref raw_content_type_options) = headers.get_raw("X-content-type-options") {
|
||||
if raw_content_type_options.iter().any(|ref opt| *opt == b"nosniff") {
|
||||
no_sniff = NoSniffFlag::ON
|
||||
no_sniff = NoSniffFlag::On
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue