OLD | NEW |
---|---|
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1144 HostPortPair mapped_origin(origin.host(), origin.port()); | 1144 HostPortPair mapped_origin(origin.host(), origin.port()); |
1145 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); | 1145 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); |
1146 QuicServerId server_id(mapped_origin, request_info.privacy_mode); | 1146 QuicServerId server_id(mapped_origin, request_info.privacy_mode); |
1147 | 1147 |
1148 HostPortPair destination( | 1148 HostPortPair destination( |
1149 alternative_service_info.alternative_service.host_port_pair()); | 1149 alternative_service_info.alternative_service.host_port_pair()); |
1150 ignore_result(ApplyHostMappingRules(original_url, &destination)); | 1150 ignore_result(ApplyHostMappingRules(original_url, &destination)); |
1151 | 1151 |
1152 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, | 1152 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, |
1153 destination)) { | 1153 destination)) { |
1154 return alternative_service_info; | 1154 // If advertised versions for QUIC is missing for this |
1155 // AlternaitverServiceInfo, by default append the list of QUIC versions | |
Bence
2017/06/08 17:44:51
s/AlternaitverServiceInfo/AlternativeServiceInfo/
Zhongyi Shi
2017/06/08 23:11:16
Acknowledged.
| |
1156 // supported by this instance of network stack. | |
1157 first_alternative_service_info = alternative_service_info; | |
1158 if (first_alternative_service_info.alternative_service.protocol == | |
1159 kProtoQUIC && | |
1160 first_alternative_service_info.advertised_versions().empty()) { | |
1161 first_alternative_service_info.set_advertised_versions( | |
1162 session_->params().quic_supported_versions); | |
1163 } | |
Ryan Hamilton
2017/06/07 20:52:24
I wonder if we can get away without this code. If
Zhongyi Shi
2017/06/08 23:11:16
Ah good idea! I didn't think about this. But yeah,
| |
1164 return first_alternative_service_info; | |
1155 } | 1165 } |
1156 | 1166 |
1157 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 1167 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
1158 if (first_alternative_service_info.alternative_service.protocol == | 1168 if (first_alternative_service_info.alternative_service.protocol == |
1159 kProtoUnknown) | 1169 kProtoUnknown) |
1160 first_alternative_service_info = alternative_service_info; | 1170 first_alternative_service_info = alternative_service_info; |
1161 } | 1171 } |
1162 | 1172 |
1163 // Ask delegate to mark QUIC as broken for the origin. | 1173 // Ask delegate to mark QUIC as broken for the origin. |
1164 if (quic_advertised && quic_all_broken && delegate != nullptr) | 1174 if (quic_advertised && quic_all_broken && delegate != nullptr) |
1165 delegate->OnQuicBroken(); | 1175 delegate->OnQuicBroken(); |
1166 | 1176 |
1177 // If advertised versions for QUIC is missing for this | |
1178 // AlternaitverServiceInfo, by default append the list of QUIC versions | |
1179 // supported by this instance of network stack. | |
1180 if (first_alternative_service_info.alternative_service.protocol == | |
1181 kProtoQUIC && | |
1182 first_alternative_service_info.advertised_versions().empty()) { | |
1183 first_alternative_service_info.set_advertised_versions( | |
1184 session_->params().quic_supported_versions); | |
1185 } | |
1186 | |
1167 return first_alternative_service_info; | 1187 return first_alternative_service_info; |
1168 } | 1188 } |
1169 | 1189 |
1170 bool HttpStreamFactoryImpl::JobController:: | 1190 bool HttpStreamFactoryImpl::JobController:: |
1171 ShouldCreateAlternativeProxyServerJob( | 1191 ShouldCreateAlternativeProxyServerJob( |
1172 const ProxyInfo& proxy_info, | 1192 const ProxyInfo& proxy_info, |
1173 const GURL& url, | 1193 const GURL& url, |
1174 ProxyServer* alternative_proxy_server) const { | 1194 ProxyServer* alternative_proxy_server) const { |
1175 DCHECK(!alternative_proxy_server->is_valid()); | 1195 DCHECK(!alternative_proxy_server->is_valid()); |
1176 | 1196 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1294 // If ReconsiderProxyAfterError() failed synchronously, it means | 1314 // If ReconsiderProxyAfterError() failed synchronously, it means |
1295 // there was nothing left to fall-back to, so fail the transaction | 1315 // there was nothing left to fall-back to, so fail the transaction |
1296 // with the last connection error we got. | 1316 // with the last connection error we got. |
1297 // TODO(eroman): This is a confusing contract, make it more obvious. | 1317 // TODO(eroman): This is a confusing contract, make it more obvious. |
1298 rv = error; | 1318 rv = error; |
1299 } | 1319 } |
1300 return rv; | 1320 return rv; |
1301 } | 1321 } |
1302 | 1322 |
1303 } // namespace net | 1323 } // namespace net |
OLD | NEW |