Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: chrome/browser/renderer_host/buffered_resource_handler.cc

Issue 18549: When the server says "nosniff" but then doesn't give us a Content-Type we now... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/buffered_resource_handler.cc
===================================================================
--- chrome/browser/renderer_host/buffered_resource_handler.cc (revision 8447)
+++ chrome/browser/renderer_host/buffered_resource_handler.cc (working copy)
@@ -116,7 +116,8 @@
request_->GetResponseHeaderByName("x-content-type-options",
&content_type_options);
- const bool sniffing_blocked = (content_type_options == "nosniff");
+ const bool sniffing_blocked =
+ LowerCaseEqualsASCII(content_type_options, "nosniff");
darin (slow to review) 2009/01/23 15:59:05 good fix
const bool we_would_like_to_sniff =
net::ShouldSniffMimeType(request_->url(), mime_type);
@@ -131,6 +132,14 @@
return true;
}
+ if (sniffing_blocked && mime_type.empty()) {
+ // Ugg. The server told us not to sniff the content but didn't give us a
+ // mime type. What's a browser to do? Turns out, we're supposed to treat
+ // the response as "text/plain". This is the most secure option.
+ mime_type.assign("text/plain");
+ response_->response_head.mime_type.assign(mime_type);
+ }
+
if (ShouldBuffer(request_->url(), mime_type)) {
// This is a temporary fix for the fact that webkit expects to have
// enough data to decode the doctype in order to select the rendering
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698