| Index: net/filter/filter.cc
|
| diff --git a/net/filter/filter.cc b/net/filter/filter.cc
|
| index af4e55128449818c72be04a0c734ed1d1eb5096a..719737daffc1813ad4884d47f2cac46512691035 100644
|
| --- a/net/filter/filter.cc
|
| +++ b/net/filter/filter.cc
|
| @@ -24,11 +24,8 @@
|
| #include "net/filter/filter.h"
|
|
|
| #include "base/files/file_path.h"
|
| -#include "base/metrics/histogram_macros.h"
|
| #include "base/strings/string_util.h"
|
| -#include "net/base/filename_util_unsafe.h"
|
| #include "net/base/io_buffer.h"
|
| -#include "net/base/mime_util.h"
|
| #include "net/base/sdch_net_log_params.h"
|
| #include "net/filter/gzip_filter.h"
|
| #include "net/filter/sdch_filter.h"
|
| @@ -49,9 +46,6 @@ const char kSdch[] = "sdch";
|
| // more information, see Firefox's nsHttpChannel::ProcessNormal.
|
|
|
| // Mime types:
|
| -const char kApplicationXGzip[] = "application/x-gzip";
|
| -const char kApplicationGzip[] = "application/gzip";
|
| -const char kApplicationXGunzip[] = "application/x-gunzip";
|
| const char kTextHtml[] = "text/html";
|
|
|
| // Buffer size allocated when de-compressing data.
|
| @@ -204,32 +198,6 @@ Filter::FilterType Filter::ConvertEncodingToType(
|
| return type_id;
|
| }
|
|
|
| -namespace {
|
| -
|
| -// Result of running FixupEncodingTypes with a Content-Encoding of gzip. This
|
| -// enum is used for UMA and is available in histograms.xml as
|
| -// GzipEncodingFixupResult.
|
| -enum GzipEncodingFixupResult {
|
| - GZIP_ENCODING_LEFT_AS_IS = 0,
|
| -
|
| - // Cleared because a resource with a GZIP MIME type was being transferred with
|
| - // a Content-Encoding of gzip.
|
| - GZIP_ENCODING_CLEARED_DUE_TO_GZIP_MIME_TYPE = 1,
|
| -
|
| - // Cleared because the resource is known to be a download and the resulting
|
| - // file had a filename that indicating that the contents are GZIP.
|
| - GZIP_ENCODING_CLEARED_DUE_TO_DOWNLOAD_OF_GZIP_FILE = 2,
|
| -
|
| - // Cleared because the resource is not a handled MIME type (and hence will be
|
| - // downloaded), and the predicted filename is one that indicates the contents
|
| - // to be GZIP.
|
| - GZIP_ENCODING_CLEARED_DUE_TO_UNHANDLED_GZIP_NAME = 3,
|
| -
|
| - GZIP_ENCODING_FIXUP_RESULT_MAX_ENTRIES
|
| -};
|
| -
|
| -} // namespace
|
| -
|
| // static
|
| void Filter::FixupEncodingTypes(
|
| const FilterContext& filter_context,
|
| @@ -238,60 +206,6 @@ void Filter::FixupEncodingTypes(
|
| bool success = filter_context.GetMimeType(&mime_type);
|
| DCHECK(success || mime_type.empty());
|
|
|
| - if ((1 == encoding_types->size()) &&
|
| - (FILTER_TYPE_GZIP == encoding_types->front())) {
|
| - GzipEncodingFixupResult fixup_result = GZIP_ENCODING_LEFT_AS_IS;
|
| - if (LowerCaseEqualsASCII(mime_type, kApplicationXGzip) ||
|
| - LowerCaseEqualsASCII(mime_type, kApplicationGzip) ||
|
| - LowerCaseEqualsASCII(mime_type, kApplicationXGunzip)) {
|
| - // The server has told us that it sent us gziped content with a gzip
|
| - // content encoding. Sadly, Apache mistakenly sets these headers for all
|
| - // .gz files. We match Firefox's nsHttpChannel::ProcessNormal and ignore
|
| - // the Content-Encoding here.
|
| - encoding_types->clear();
|
| - fixup_result = GZIP_ENCODING_CLEARED_DUE_TO_GZIP_MIME_TYPE;
|
| - }
|
| -
|
| - GURL url;
|
| - std::string disposition;
|
| - success = filter_context.GetURL(&url);
|
| - DCHECK(success);
|
| - filter_context.GetContentDisposition(&disposition);
|
| - // Don't supply a MIME type here, since that may cause disk IO.
|
| - base::FilePath::StringType extension =
|
| - GenerateFileExtensionUnsafe(url, disposition, "UTF-8", "", "", "");
|
| -
|
| - if (filter_context.IsDownload()) {
|
| - // We don't want to decompress gzipped files when the user explicitly
|
| - // asks to download them.
|
| - // For the case of svgz files, we use the extension to distinguish
|
| - // between svgz files and svg files compressed with gzip by the server.
|
| - // When viewing a .svgz file, we need to uncompress it, but we don't
|
| - // want to do that when downloading.
|
| - // See Firefox's nonDecodableExtensions in nsExternalHelperAppService.cpp
|
| - if (EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) ||
|
| - LowerCaseEqualsASCII(extension, ".tgz") ||
|
| - LowerCaseEqualsASCII(extension, ".svgz")) {
|
| - encoding_types->clear();
|
| - fixup_result = GZIP_ENCODING_CLEARED_DUE_TO_DOWNLOAD_OF_GZIP_FILE;
|
| - }
|
| - } else {
|
| - // When the user does not explicitly ask to download a file, if we get a
|
| - // supported mime type, then we attempt to decompress in order to view it.
|
| - // However, if it's not a supported mime type, then we will attempt to
|
| - // download it, and in that case, don't decompress .gz/.tgz files.
|
| - if ((EndsWith(extension, FILE_PATH_LITERAL(".gz"), false) ||
|
| - LowerCaseEqualsASCII(extension, ".tgz")) &&
|
| - !IsSupportedMimeType(mime_type)) {
|
| - encoding_types->clear();
|
| - fixup_result = GZIP_ENCODING_CLEARED_DUE_TO_UNHANDLED_GZIP_NAME;
|
| - }
|
| - }
|
| -
|
| - UMA_HISTOGRAM_ENUMERATION("Net.GzipEncodingFixupResult", fixup_result,
|
| - GZIP_ENCODING_FIXUP_RESULT_MAX_ENTRIES);
|
| - }
|
| -
|
| // If the request was for SDCH content, then we might need additional fixups.
|
| if (!filter_context.SdchDictionariesAdvertised()) {
|
| // It was not an SDCH request, so we'll just record stats.
|
|
|