| 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.h" | 5 #include "net/http/http_stream_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (!match_found) { | 68 if (!match_found) { |
| 69 continue; | 69 continue; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 AlternativeService alternative_service(protocol, | 72 AlternativeService alternative_service(protocol, |
| 73 alternative_service_entry.host, | 73 alternative_service_entry.host, |
| 74 alternative_service_entry.port); | 74 alternative_service_entry.port); |
| 75 base::Time expiration = | 75 base::Time expiration = |
| 76 base::Time::Now() + | 76 base::Time::Now() + |
| 77 base::TimeDelta::FromSeconds(alternative_service_entry.max_age); | 77 base::TimeDelta::FromSeconds(alternative_service_entry.max_age); |
| 78 AlternativeServiceInfo alternative_service_info(alternative_service, | 78 // TODO(zhongyi): set mutually supported versions to AlternativeServiceInfo |
| 79 expiration); | 79 // in the subsequent CL. |
| 80 AlternativeServiceInfo alternative_service_info( |
| 81 alternative_service, expiration, |
| 82 session->params().quic_supported_versions); |
| 80 alternative_service_info_vector.push_back(alternative_service_info); | 83 alternative_service_info_vector.push_back(alternative_service_info); |
| 81 } | 84 } |
| 82 | 85 |
| 83 session->http_server_properties()->SetAlternativeServices( | 86 session->http_server_properties()->SetAlternativeServices( |
| 84 RewriteHost(http_server), alternative_service_info_vector); | 87 RewriteHost(http_server), alternative_service_info_vector); |
| 85 } | 88 } |
| 86 | 89 |
| 87 HttpStreamFactory::HttpStreamFactory() {} | 90 HttpStreamFactory::HttpStreamFactory() {} |
| 88 | 91 |
| 89 url::SchemeHostPort HttpStreamFactory::RewriteHost( | 92 url::SchemeHostPort HttpStreamFactory::RewriteHost( |
| 90 const url::SchemeHostPort& server) { | 93 const url::SchemeHostPort& server) { |
| 91 HostPortPair host_port_pair(server.host(), server.port()); | 94 HostPortPair host_port_pair(server.host(), server.port()); |
| 92 const HostMappingRules* mapping_rules = GetHostMappingRules(); | 95 const HostMappingRules* mapping_rules = GetHostMappingRules(); |
| 93 if (mapping_rules) | 96 if (mapping_rules) |
| 94 mapping_rules->RewriteHost(&host_port_pair); | 97 mapping_rules->RewriteHost(&host_port_pair); |
| 95 return url::SchemeHostPort(server.scheme(), host_port_pair.host(), | 98 return url::SchemeHostPort(server.scheme(), host_port_pair.host(), |
| 96 host_port_pair.port()); | 99 host_port_pair.port()); |
| 97 } | 100 } |
| 98 | 101 |
| 99 } // namespace net | 102 } // namespace net |
| OLD | NEW |