Enable optional mime sniffing, and integrate it with the file loader.

This commit is contained in:
Josh Matthews 2015-02-21 11:22:31 -05:00
parent 2d730f2ae9
commit a3201bc1ac
8 changed files with 102 additions and 152 deletions

View file

@ -128,6 +128,9 @@ pub struct Opts {
/// A specific path to find required resources (such as user-agent.css).
pub resources_path: Option<String>,
/// Whether MIME sniffing should be used
pub sniff_mime_types: bool,
}
fn print_usage(app: &str, opts: &[getopts::OptGroup]) {
@ -207,6 +210,7 @@ pub fn default_opts() -> Opts {
validate_display_list_geometry: false,
profile_tasks: false,
resources_path: None,
sniff_mime_types: false,
}
}
@ -238,6 +242,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
getopts::optflag("h", "help", "Print this message"),
getopts::optopt("r", "render-api", "Set the rendering API to use", "gl|mesa"),
getopts::optopt("", "resources-path", "Path to find static resources", "/home/servo/resources"),
getopts::optflag("", "sniff-mime-types" , "Enable MIME sniffing"),
);
let opt_match = match getopts::getopts(args, opts.as_slice()) {
@ -360,6 +365,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
relayout_event: debug_options.contains(&"relayout-event"),
validate_display_list_geometry: debug_options.contains(&"validate-display-list-geometry"),
resources_path: opt_match.opt_str("resources-path"),
sniff_mime_types: opt_match.opt_present("sniff-mime-types"),
};
set_opts(opts);