Chromium Code Reviews| 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; |
| } |