mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Consistently use content-type sniffing with all protocols.
This commit is contained in:
parent
53d8f04ac4
commit
aef06f2f20
5 changed files with 44 additions and 38 deletions
|
@ -59,11 +59,6 @@ pub fn send_error(url: Url, err: String, start_chan: LoadConsumer) {
|
|||
}
|
||||
}
|
||||
|
||||
/// For use by loaders in responding to a Load message.
|
||||
pub fn start_sending(start_chan: LoadConsumer, metadata: Metadata) -> ProgressSender {
|
||||
start_sending_opt(start_chan, metadata).ok().unwrap()
|
||||
}
|
||||
|
||||
/// For use by loaders in responding to a Load message that allows content sniffing.
|
||||
pub fn start_sending_sniffed(start_chan: LoadConsumer, metadata: Metadata,
|
||||
classifier: Arc<MIMEClassifier>, partial_body: &[u8])
|
||||
|
@ -122,7 +117,7 @@ fn apache_bug_predicate(last_raw_content_type: &[u8]) -> ApacheBugFlag {
|
|||
}
|
||||
|
||||
/// For use by loaders in responding to a Load message.
|
||||
pub fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result<ProgressSender, ()> {
|
||||
fn start_sending_opt(start_chan: LoadConsumer, metadata: Metadata) -> Result<ProgressSender, ()> {
|
||||
match start_chan {
|
||||
LoadConsumer::Channel(start_chan) => {
|
||||
let (progress_chan, progress_port) = ipc::channel().unwrap();
|
||||
|
@ -253,8 +248,7 @@ impl ResourceManager {
|
|||
"about" => from_factory(about_loader::factory),
|
||||
_ => {
|
||||
debug!("resource_task: no loader for scheme {}", load_data.url.scheme);
|
||||
start_sending(consumer, Metadata::default(load_data.url))
|
||||
.send(ProgressMsg::Done(Err("no loader for scheme".to_owned()))).unwrap();
|
||||
send_error(load_data.url, "no loader for scheme".to_owned(), consumer);
|
||||
return
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue