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

Unified Diff: net/base/filter.cc

Issue 42452: Do not apply gzip filter to file names with gz/tgz/svgz extensions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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: net/base/filter.cc
===================================================================
--- net/base/filter.cc (revision 12425)
+++ net/base/filter.cc (working copy)
@@ -4,6 +4,7 @@
#include "net/base/filter.h"
+#include "base/file_path.h"
#include "base/string_util.h"
#include "net/base/gzip_filter.h"
#include "net/base/bzip2_filter.h"
@@ -93,6 +94,21 @@
// .gz files. We match Firefox's nsHttpChannel::ProcessNormal and ignore
// the Content-Encoding here.
encoding_types->clear();
+
+ GURL url;
+ success = filter_context.GetURL(&url);
+ DCHECK(success);
+ FilePath filename = FilePath().AppendASCII(url.ExtractFileName());
+ FilePath::StringType extension = filename.Extension();
+
+ // Firefox does not apply the filter to the following extensions.
+ // See Firefox's nsHttpChannel::nsContentEncodings::GetNext() and
+ // nonDecodableExtensions in nsExternalHelperAppService.cpp
+ if (0 == extension.compare(FILE_PATH_LITERAL(".gz")) ||
+ 0 == extension.compare(FILE_PATH_LITERAL(".tgz")) ||
+ 0 == extension.compare(FILE_PATH_LITERAL(".svgz"))) {
+ encoding_types->clear();
+ }
}
if (!filter_context.IsSdchResponse()) {
« 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