diff options
author | Corey Farwell <coreyf@rwell.org> | 2017-07-26 22:58:19 +0000 |
---|---|---|
committer | Corey Farwell <coreyf@rwell.org> | 2017-07-26 23:44:01 +0000 |
commit | 23e5bfaf27312840092d9938bb99748a02e0d9bf (patch) | |
tree | 6ab3cb8cb26dd1226c5178d7f49fa5eef47f51cb /components/net/fetch/methods.rs | |
parent | 58fd2956b339781c963f14eb9edb9ae71858e68b (diff) | |
download | servo-23e5bfaf27312840092d9938bb99748a02e0d9bf.tar.gz servo-23e5bfaf27312840092d9938bb99748a02e0d9bf.zip |
Audit usages of unicode case-changing methods.
Diffstat (limited to 'components/net/fetch/methods.rs')
-rw-r--r-- | components/net/fetch/methods.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index b6b5d80231c..59da722fb03 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -21,6 +21,7 @@ use net_traits::request::{Referrer, Request, RequestMode, ResponseTainting}; use net_traits::request::{Type, Origin, Window}; use net_traits::response::{Response, ResponseBody, ResponseType}; use servo_url::ServoUrl; +use std::ascii::AsciiExt; use std::borrow::Cow; use std::fmt; use std::fs::File; @@ -514,9 +515,10 @@ pub fn should_be_blocked_due_to_nosniff(request_type: Type, response_headers: &H fn parse_header(raw: &[Vec<u8>]) -> HyperResult<Self> { raw.first() .and_then(|v| str::from_utf8(v).ok()) - .and_then(|s| match s.trim().to_lowercase().as_str() { - "nosniff" => Some(XContentTypeOptions), - _ => None + .and_then(|s| if s.trim().eq_ignore_ascii_case("nosniff") { + Some(XContentTypeOptions) + } else { + None }) .ok_or(Error::Header) } |