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

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

Issue 173536: RDH: Don't attempt to sniff the mime type of requests that... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 | chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc » ('j') | 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 24201)
+++ chrome/browser/renderer_host/buffered_resource_handler.cc (working copy)
@@ -151,8 +151,12 @@
const bool sniffing_blocked =
LowerCaseEqualsASCII(content_type_options, "nosniff");
+ const bool no_data =
+ response_->response_head.headers && // Can be NULL if FTP.
+ (response_->response_head.headers->response_code() == 304 ||
eroman 2009/09/01 03:30:58 I'm not sure that it is appropriate to put HTTP-co
+ response_->response_head.headers->response_code() == 204);
const bool we_would_like_to_sniff =
- net::ShouldSniffMimeType(request_->url(), mime_type);
+ no_data ? false : net::ShouldSniffMimeType(request_->url(), mime_type);
RecordSnifferMetrics(sniffing_blocked, we_would_like_to_sniff, mime_type);
@@ -165,7 +169,7 @@
return true;
}
- if (sniffing_blocked && mime_type.empty()) {
+ if (sniffing_blocked && mime_type.empty() && !no_data) {
// 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.
@@ -182,7 +186,7 @@
return true;
}
- if (ShouldWaitForPlugins()) {
+ if (!no_data && ShouldWaitForPlugins()) {
wait_for_plugins_ = true;
return true;
}
« no previous file with comments | « no previous file | chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698