OLD | NEW |
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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 size_t iter = 0; | 1064 size_t iter = 0; |
1065 while (headers->EnumerateHeader(&iter, "Content-Encoding", &type)) { | 1065 while (headers->EnumerateHeader(&iter, "Content-Encoding", &type)) { |
1066 if (base::LowerCaseEqualsASCII(type, kBrotli)) { | 1066 if (base::LowerCaseEqualsASCII(type, kBrotli)) { |
1067 types.push_back(SourceStream::TYPE_BROTLI); | 1067 types.push_back(SourceStream::TYPE_BROTLI); |
1068 } else if (base::LowerCaseEqualsASCII(type, kDeflate)) { | 1068 } else if (base::LowerCaseEqualsASCII(type, kDeflate)) { |
1069 types.push_back(SourceStream::TYPE_DEFLATE); | 1069 types.push_back(SourceStream::TYPE_DEFLATE); |
1070 } else if (base::LowerCaseEqualsASCII(type, kGZip) || | 1070 } else if (base::LowerCaseEqualsASCII(type, kGZip) || |
1071 base::LowerCaseEqualsASCII(type, kXGZip)) { | 1071 base::LowerCaseEqualsASCII(type, kXGZip)) { |
1072 types.push_back(SourceStream::TYPE_GZIP); | 1072 types.push_back(SourceStream::TYPE_GZIP); |
1073 } else if (base::LowerCaseEqualsASCII(type, kSdch)) { | 1073 } else if (base::LowerCaseEqualsASCII(type, kSdch)) { |
| 1074 // If SDCH support is not configured, pass through raw response. |
| 1075 if (!request()->context()->sdch_manager()) |
| 1076 return upstream; |
1074 types.push_back(SourceStream::TYPE_SDCH); | 1077 types.push_back(SourceStream::TYPE_SDCH); |
1075 } else { | 1078 } else { |
1076 // Unknown encoding type. Pass through raw response body. | 1079 // Unknown encoding type. Pass through raw response body. |
1077 return upstream; | 1080 return upstream; |
1078 } | 1081 } |
1079 } | 1082 } |
1080 | 1083 |
1081 // Sdch specific hacks: | 1084 // Sdch specific hacks: |
1082 std::string mime_type; | 1085 std::string mime_type; |
1083 bool success = GetMimeType(&mime_type); | 1086 bool success = GetMimeType(&mime_type); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 awaiting_callback_ = false; | 1541 awaiting_callback_ = false; |
1539 | 1542 |
1540 // Notify NetworkQualityEstimator. | 1543 // Notify NetworkQualityEstimator. |
1541 NetworkQualityEstimator* network_quality_estimator = | 1544 NetworkQualityEstimator* network_quality_estimator = |
1542 request()->context()->network_quality_estimator(); | 1545 request()->context()->network_quality_estimator(); |
1543 if (network_quality_estimator) | 1546 if (network_quality_estimator) |
1544 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1547 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
1545 } | 1548 } |
1546 | 1549 |
1547 } // namespace net | 1550 } // namespace net |
OLD | NEW |