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

Side by Side Diff: net/http/http_network_transaction.cc

Issue 2849193002: Revert "Do not abort redirect responses with unadvertised encoding." (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 FilterSourceStream::ReportContentDecodingFailed(SourceStream::TYPE_INVALID); 1794 FilterSourceStream::ReportContentDecodingFailed(SourceStream::TYPE_INVALID);
1795 return false; 1795 return false;
1796 } 1796 }
1797 1797
1798 // When "Accept-Encoding" is not specified, it is parsed as "*". 1798 // When "Accept-Encoding" is not specified, it is parsed as "*".
1799 // If "*" encoding is advertised, then any encoding should be "accepted". 1799 // If "*" encoding is advertised, then any encoding should be "accepted".
1800 // This does not mean, that it will be successfully decoded. 1800 // This does not mean, that it will be successfully decoded.
1801 if (allowed_encodings.find("*") != allowed_encodings.end()) 1801 if (allowed_encodings.find("*") != allowed_encodings.end())
1802 return true; 1802 return true;
1803 1803
1804 bool result = true;
1805 for (auto const& encoding : used_encodings) { 1804 for (auto const& encoding : used_encodings) {
1806 SourceStream::SourceType source_type = 1805 SourceStream::SourceType source_type =
1807 FilterSourceStream::ParseEncodingType(encoding); 1806 FilterSourceStream::ParseEncodingType(encoding);
1808 // We don't reject encodings we are not aware. They just will not decode. 1807 // We don't reject encodings we are not aware. They just will not decode.
1809 if (source_type == SourceStream::TYPE_UNKNOWN) 1808 if (source_type == SourceStream::TYPE_UNKNOWN)
1810 continue; 1809 continue;
1811 if (allowed_encodings.find(encoding) == allowed_encodings.end()) { 1810 if (allowed_encodings.find(encoding) == allowed_encodings.end()) {
1812 FilterSourceStream::ReportContentDecodingFailed( 1811 FilterSourceStream::ReportContentDecodingFailed(source_type);
1813 SourceStream::TYPE_REJECTED); 1812 return false;
1814 result = false;
1815 break;
1816 } 1813 }
1817 } 1814 }
1818 1815 return true;
1819 // Temporary workaround for http://crbug.com/714514
1820 if (headers->IsRedirect(nullptr)) {
1821 UMA_HISTOGRAM_BOOLEAN("Net.RedirectWithUnadvertisedContentEncoding",
1822 !result);
1823 return true;
1824 }
1825
1826 return result;
1827 } 1816 }
1828 1817
1829 } // namespace net 1818 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698