diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 64aa635fba414..5ef7e49f34d4b 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -4419,6 +4419,33 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, DuplicateContentDisposition) { downloads[0]->GetTargetFilePath().BaseName().value()); } +IN_PROC_BROWSER_TEST_F(DownloadContentTest, + CompressedResponseWithContentDisposition) { + // gzip-content-with-content-disposition.gz is served with Content-Disposition + // headers, and `Content-Encoding: gzip`. + NavigateToURLAndWaitForDownload( + shell(), + embedded_test_server()->GetURL( + "/download/gzip-content-with-content-disposition.gz"), + download::DownloadItem::COMPLETE); + + std::vector<raw_ptr<download::DownloadItem, VectorExperimental>> downloads; + DownloadManagerForShell(shell())->GetAllDownloads(&downloads); + ASSERT_EQ(1u, downloads.size()); + + EXPECT_EQ(FILE_PATH_LITERAL("hello.txt"), + downloads[0]->GetTargetFilePath().BaseName().value()); + + // Verify the file is downloaded correctly. + { + base::ScopedAllowBlockingForTesting allow_blocking; + std::string downloaded_content; + ASSERT_TRUE(base::ReadFileToString(downloads[0]->GetTargetFilePath(), + &downloaded_content)); + EXPECT_EQ(downloaded_content, "Hello World!\n"); + } +} + // Test that the network isolation key is populated for: // (1) <a download> triggered download request that doesn't go through the // navigation path diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 93eeb76b470d5..09ae902fb9489 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc @@ -559,11 +559,6 @@ std::unique_ptr<network::ResourceRequest> CreateResourceRequestForNavigation( new_request->enable_load_timing = true; - if (base::FeatureList::IsEnabled( - network::features::kRendererSideContentDecoding)) { - new_request->client_side_content_decoding_enabled = true; - } - return new_request; } diff --git a/content/test/content_test_bundle_data.filelist b/content/test/content_test_bundle_data.filelist index aff7764adcd13..3dd51e7b492de 100644 --- a/content/test/content_test_bundle_data.filelist +++ b/content/test/content_test_bundle_data.filelist @@ -6671,6 +6671,8 @@ data/download/download-with-xfo-deny.html.mock-http-headers data/download/empty.bin data/download/empty.bin.mock-http-headers data/download/forms.mhtml +data/download/gzip-content-with-content-disposition.gz +data/download/gzip-content-with-content-disposition.gz.mock-http-headers data/download/gzip-content.gz data/download/gzip-content.gz.mock-http-headers data/download/hello.mhtml diff --git a/content/test/data/download/gzip-content-with-content-disposition.gz b/content/test/data/download/gzip-content-with-content-disposition.gz new file mode 100644 index 0000000000000..eb478f7843210 Binary files /dev/null and b/content/test/data/download/gzip-content-with-content-disposition.gz differ diff --git a/content/test/data/download/gzip-content-with-content-disposition.gz.mock-http-headers b/content/test/data/download/gzip-content-with-content-disposition.gz.mock-http-headers new file mode 100644 index 0000000000000..ab57591785f25 --- /dev/null +++ b/content/test/data/download/gzip-content-with-content-disposition.gz.mock-http-headers @@ -0,0 +1,4 @@ +HTTP/1.1 200 OK +Content-Length: 33 +Content-Disposition: attachment; filename=hello.txt +Content-Encoding: gzip