summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 18:02:27 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 18:02:27 +0000
commit55c2ed7f0ebfdc88213175022ac12de5a17a82d5 (patch)
treeb935fd8732ef44195153a8247c312b26b96afc7f /net
parent43f0aaeb568fd974d442dd088f0d0036f8e1a61f (diff)
downloadchromium_src-55c2ed7f0ebfdc88213175022ac12de5a17a82d5.zip
chromium_src-55c2ed7f0ebfdc88213175022ac12de5a17a82d5.tar.gz
chromium_src-55c2ed7f0ebfdc88213175022ac12de5a17a82d5.tar.bz2
Do not apply gzip filter to file names with gz/tgz/svgz extensions.
This matches Firefox's behavior. BUG=8170 Review URL: http://codereview.chromium.org/42452 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/filter.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/net/base/filter.cc b/net/base/filter.cc
index 397a599..d15635a 100644
--- a/net/base/filter.cc
+++ b/net/base/filter.cc
@@ -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 @@ void Filter::FixupEncodingTypes(
// .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()) {