| 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/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 AlternativeService HttpStreamFactoryImpl::GetAlternativeServiceFor( | 178 AlternativeService HttpStreamFactoryImpl::GetAlternativeServiceFor( |
| 179 const HttpRequestInfo& request_info, | 179 const HttpRequestInfo& request_info, |
| 180 HttpStreamRequest::Delegate* delegate, | 180 HttpStreamRequest::Delegate* delegate, |
| 181 HttpStreamRequest::StreamType stream_type) { | 181 HttpStreamRequest::StreamType stream_type) { |
| 182 GURL original_url = request_info.url; | 182 GURL original_url = request_info.url; |
| 183 | 183 |
| 184 if (original_url.SchemeIs("ftp")) | 184 if (original_url.SchemeIs("ftp")) |
| 185 return AlternativeService(); | 185 return AlternativeService(); |
| 186 | 186 |
| 187 HostPortPair origin = HostPortPair::FromURL(original_url); | 187 url::SchemeHostPort origin(original_url); |
| 188 HttpServerProperties& http_server_properties = | 188 HttpServerProperties& http_server_properties = |
| 189 *session_->http_server_properties(); | 189 *session_->http_server_properties(); |
| 190 const AlternativeServiceVector alternative_service_vector = | 190 const AlternativeServiceVector alternative_service_vector = |
| 191 http_server_properties.GetAlternativeServices(origin); | 191 http_server_properties.GetAlternativeServices(origin); |
| 192 if (alternative_service_vector.empty()) | 192 if (alternative_service_vector.empty()) |
| 193 return AlternativeService(); | 193 return AlternativeService(); |
| 194 | 194 |
| 195 bool quic_advertised = false; | 195 bool quic_advertised = false; |
| 196 bool quic_all_broken = true; | 196 bool quic_all_broken = true; |
| 197 | 197 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 continue; | 257 continue; |
| 258 | 258 |
| 259 if (!original_url.SchemeIs("https")) | 259 if (!original_url.SchemeIs("https")) |
| 260 continue; | 260 continue; |
| 261 | 261 |
| 262 // Check whether there is an existing QUIC session to use for this origin. | 262 // Check whether there is an existing QUIC session to use for this origin. |
| 263 HostPortPair destination(alternative_service.host_port_pair()); | 263 HostPortPair destination(alternative_service.host_port_pair()); |
| 264 ignore_result(ApplyHostMappingRules(original_url, &destination)); | 264 ignore_result(ApplyHostMappingRules(original_url, &destination)); |
| 265 QuicServerId server_id(destination, request_info.privacy_mode); | 265 QuicServerId server_id(destination, request_info.privacy_mode); |
| 266 | 266 |
| 267 HostPortPair origin_copy(origin); | 267 HostPortPair origin_copy(origin.host(), origin.port()); |
| 268 ignore_result(ApplyHostMappingRules(original_url, &origin_copy)); | 268 ignore_result(ApplyHostMappingRules(original_url, &origin_copy)); |
| 269 | 269 |
| 270 if (session_->quic_stream_factory()->CanUseExistingSession( | 270 if (session_->quic_stream_factory()->CanUseExistingSession( |
| 271 server_id, origin_copy.host())) { | 271 server_id, origin_copy.host())) { |
| 272 return alternative_service; | 272 return alternative_service; |
| 273 } | 273 } |
| 274 | 274 |
| 275 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 275 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
| 276 if (first_alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) | 276 if (first_alternative_service.protocol == UNINITIALIZED_ALTERNATE_PROTOCOL) |
| 277 first_alternative_service = alternative_service; | 277 first_alternative_service = alternative_service; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return true; | 363 return true; |
| 364 | 364 |
| 365 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) | 365 if (session_->params().transport_security_state->IsGooglePinnedHost(host)) |
| 366 return true; | 366 return true; |
| 367 | 367 |
| 368 return ContainsKey(session_->params().quic_host_whitelist, | 368 return ContainsKey(session_->params().quic_host_whitelist, |
| 369 base::ToLowerASCII(host)); | 369 base::ToLowerASCII(host)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace net | 372 } // namespace net |
| OLD | NEW |