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

Side by Side Diff: net/url_request/url_request_http_job.cc

Issue 2753453003: Reject unadvertised encodings (Closed)
Patch Set: Extracted code for UMA reporting Created 3 years, 9 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
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/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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 types.push_back(SourceStream::TYPE_DEFLATE); 1070 types.push_back(SourceStream::TYPE_DEFLATE);
1071 } else if (base::LowerCaseEqualsASCII(type, kGZip) || 1071 } else if (base::LowerCaseEqualsASCII(type, kGZip) ||
1072 base::LowerCaseEqualsASCII(type, kXGZip)) { 1072 base::LowerCaseEqualsASCII(type, kXGZip)) {
1073 types.push_back(SourceStream::TYPE_GZIP); 1073 types.push_back(SourceStream::TYPE_GZIP);
1074 } else if (base::LowerCaseEqualsASCII(type, kSdch)) { 1074 } else if (base::LowerCaseEqualsASCII(type, kSdch)) {
1075 // If SDCH support is not configured, pass through raw response. 1075 // If SDCH support is not configured, pass through raw response.
1076 if (!request()->context()->sdch_manager()) 1076 if (!request()->context()->sdch_manager())
1077 return upstream; 1077 return upstream;
1078 types.push_back(SourceStream::TYPE_SDCH); 1078 types.push_back(SourceStream::TYPE_SDCH);
1079 } else { 1079 } else {
1080 // Unknown encoding type. Pass through raw response body. 1080 // Unknown encoding type. Pass through raw response body.
Randy Smith (Not in Mondays) 2017/03/21 21:23:20 Would you be willing to put an entry in here for t
eustas 2017/03/27 10:27:11 Yup, but I didn't get what item should be added...
Randy Smith (Not in Mondays) 2017/03/28 19:55:36 Just report UNKNOWN--we can't change the behavior.
1081 return upstream; 1081 return upstream;
1082 } 1082 }
1083 } 1083 }
1084 1084
1085 // Sdch specific hacks: 1085 // Sdch specific hacks:
1086 std::string mime_type; 1086 std::string mime_type;
1087 bool success = GetMimeType(&mime_type); 1087 bool success = GetMimeType(&mime_type);
1088 DCHECK(success || mime_type.empty()); 1088 DCHECK(success || mime_type.empty());
1089 SdchPolicyDelegate::FixUpSdchContentEncodings( 1089 SdchPolicyDelegate::FixUpSdchContentEncodings(
1090 request()->net_log(), mime_type, dictionaries_advertised_.get(), &types); 1090 request()->net_log(), mime_type, dictionaries_advertised_.get(), &types);
(...skipping 21 matching lines...) Expand all
1112 } 1112 }
1113 break; 1113 break;
1114 } 1114 }
1115 case SourceStream::TYPE_GZIP: 1115 case SourceStream::TYPE_GZIP:
1116 case SourceStream::TYPE_DEFLATE: 1116 case SourceStream::TYPE_DEFLATE:
1117 case SourceStream::TYPE_GZIP_FALLBACK: 1117 case SourceStream::TYPE_GZIP_FALLBACK:
1118 downstream = GzipSourceStream::Create(std::move(upstream), type); 1118 downstream = GzipSourceStream::Create(std::move(upstream), type);
1119 break; 1119 break;
1120 case SourceStream::TYPE_NONE: 1120 case SourceStream::TYPE_NONE:
1121 case SourceStream::TYPE_INVALID: 1121 case SourceStream::TYPE_INVALID:
1122 case SourceStream::TYPE_UNKNOWN:
1122 case SourceStream::TYPE_MAX: 1123 case SourceStream::TYPE_MAX:
1123 NOTREACHED(); 1124 NOTREACHED();
1124 return nullptr; 1125 return nullptr;
1125 } 1126 }
1126 if (downstream == nullptr) 1127 if (downstream == nullptr)
1127 return nullptr; 1128 return nullptr;
1128 upstream = std::move(downstream); 1129 upstream = std::move(downstream);
1129 } 1130 }
1130 1131
1131 return upstream; 1132 return upstream;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 awaiting_callback_ = false; 1552 awaiting_callback_ = false;
1552 1553
1553 // Notify NetworkQualityEstimator. 1554 // Notify NetworkQualityEstimator.
1554 NetworkQualityEstimator* network_quality_estimator = 1555 NetworkQualityEstimator* network_quality_estimator =
1555 request()->context()->network_quality_estimator(); 1556 request()->context()->network_quality_estimator();
1556 if (network_quality_estimator) 1557 if (network_quality_estimator)
1557 network_quality_estimator->NotifyURLRequestDestroyed(*request()); 1558 network_quality_estimator->NotifyURLRequestDestroyed(*request());
1558 } 1559 }
1559 1560
1560 } // namespace net 1561 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698